Sat, 09 May 2020 14:26:31 +0200
converts to maven project
1.1 --- a/.hgignore Sun Apr 08 16:51:15 2018 +0200 1.2 +++ b/.hgignore Sat May 09 14:26:31 2020 +0200 1.3 @@ -1,9 +1,12 @@ 1.4 syntax: regexp 1.5 ^nbproject/private/ 1.6 ^build/ 1.7 +^target/ 1.8 ^dist/ 1.9 \.orig\..*$ 1.10 \.orig$ 1.11 \.chg\..*$ 1.12 \.rej$ 1.13 \.conflict\~$ 1.14 +\.iml$ 1.15 +\.idea/
2.1 --- a/build.xml Sun Apr 08 16:51:15 2018 +0200 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,71 +0,0 @@ 2.4 -<?xml version="1.0" encoding="UTF-8"?> 2.5 -<!-- You may freely edit this file. See commented blocks below for --> 2.6 -<!-- some examples of how to customize the build. --> 2.7 -<!-- (If you delete it and reopen the project it will be recreated.) --> 2.8 -<!-- By default, only the Clean and Build commands use this build script. --> 2.9 -<!-- Commands such as Run, Debug, and Test only use this build script if --> 2.10 -<!-- the Compile on Save feature is turned off for the project. --> 2.11 -<!-- You can turn off the Compile on Save (or Deploy on Save) setting --> 2.12 -<!-- in the project's Project Properties dialog box.--> 2.13 -<project name="LightPIT" default="default" basedir="."> 2.14 - <description>Builds, tests, and runs the project LightPIT.</description> 2.15 - <import file="nbproject/build-impl.xml"/> 2.16 - <!-- 2.17 - 2.18 - There exist several targets which are by default empty and which can be 2.19 - used for execution of your tasks. These targets are usually executed 2.20 - before and after some main targets. They are: 2.21 - 2.22 - -pre-init: called before initialization of project properties 2.23 - -post-init: called after initialization of project properties 2.24 - -pre-compile: called before javac compilation 2.25 - -post-compile: called after javac compilation 2.26 - -pre-compile-single: called before javac compilation of single file 2.27 - -post-compile-single: called after javac compilation of single file 2.28 - -pre-compile-test: called before javac compilation of JUnit tests 2.29 - -post-compile-test: called after javac compilation of JUnit tests 2.30 - -pre-compile-test-single: called before javac compilation of single JUnit test 2.31 - -post-compile-test-single: called after javac compilation of single JUunit test 2.32 - -pre-dist: called before archive building 2.33 - -post-dist: called after archive building 2.34 - -post-clean: called after cleaning build products 2.35 - -pre-run-deploy: called before deploying 2.36 - -post-run-deploy: called after deploying 2.37 - 2.38 - Example of pluging an obfuscator after the compilation could look like 2.39 - 2.40 - <target name="-post-compile"> 2.41 - <obfuscate> 2.42 - <fileset dir="${build.classes.dir}"/> 2.43 - </obfuscate> 2.44 - </target> 2.45 - 2.46 - For list of available properties check the imported 2.47 - nbproject/build-impl.xml file. 2.48 - 2.49 - 2.50 - Other way how to customize the build is by overriding existing main targets. 2.51 - The target of interest are: 2.52 - 2.53 - init-macrodef-javac: defines macro for javac compilation 2.54 - init-macrodef-junit: defines macro for junit execution 2.55 - init-macrodef-debug: defines macro for class debugging 2.56 - do-dist: archive building 2.57 - run: execution of project 2.58 - javadoc-build: javadoc generation 2.59 - 2.60 - Example of overriding the target for project execution could look like 2.61 - 2.62 - <target name="run" depends="<PROJNAME>-impl.jar"> 2.63 - <exec dir="bin" executable="launcher.exe"> 2.64 - <arg file="${dist.jar}"/> 2.65 - </exec> 2.66 - </target> 2.67 - 2.68 - Notice that overridden target depends on jar target and not only on 2.69 - compile target as regular run target does. Again, for list of available 2.70 - properties which you can use check the target you are overriding in 2.71 - nbproject/build-impl.xml file. 2.72 - 2.73 - --> 2.74 -</project>
3.1 --- a/nbproject/ant-deploy.xml Sun Apr 08 16:51:15 2018 +0200 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,76 +0,0 @@ 3.4 -<?xml version="1.0" encoding="UTF-8"?> 3.5 -<!-- 3.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3.7 - 3.8 -Copyright (c) 2006, 2016 Oracle and/or its affiliates. All rights reserved. 3.9 - 3.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates. 3.11 -Other names may be trademarks of their respective owners. 3.12 - 3.13 -The contents of this file are subject to the terms of either the GNU 3.14 -General Public License Version 2 only ("GPL") or the Common 3.15 -Development and Distribution License("CDDL") (collectively, the 3.16 -"License"). You may not use this file except in compliance with the 3.17 -License. You can obtain a copy of the License at 3.18 -http://www.netbeans.org/cddl-gplv2.html 3.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the 3.20 -specific language governing permissions and limitations under the 3.21 -License. When distributing the software, include this License Header 3.22 -Notice in each file and include the License file at 3.23 -nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this 3.24 -particular file as subject to the "Classpath" exception as provided 3.25 -by Oracle in the GPL Version 2 section of the License file that 3.26 -accompanied this code. If applicable, add the following below the 3.27 -License Header, with the fields enclosed by brackets [] replaced by 3.28 -your own identifying information: 3.29 -"Portions Copyrighted [year] [name of copyright owner]" 3.30 - 3.31 -If you wish your version of this file to be governed by only the CDDL 3.32 -or only the GPL Version 2, indicate your decision by adding 3.33 -"[Contributor] elects to include this software in this distribution 3.34 -under the [CDDL or GPL Version 2] license." If you do not indicate a 3.35 -single choice of license, a recipient has the option to distribute 3.36 -your version of this file under either the CDDL, the GPL Version 2 or 3.37 -to extend the choice of license to its licensees as provided above. 3.38 -However, if you add GPL Version 2 code and therefore, elected the GPL 3.39 -Version 2 license, then the option applies only if the new code is 3.40 -made subject to such option by the copyright holder. 3.41 - 3.42 -Contributor(s): 3.43 ---> 3.44 -<project default="-deploy-ant" basedir="."> 3.45 - <target name="-init" if="deploy.ant.enabled"> 3.46 - <property file="${deploy.ant.properties.file}"/> 3.47 - <tempfile property="temp.module.folder" prefix="tomcat" destdir="${java.io.tmpdir}"/> 3.48 - <unwar src="${deploy.ant.archive}" dest="${temp.module.folder}"> 3.49 - <patternset includes="META-INF/context.xml"/> 3.50 - </unwar> 3.51 - <xmlproperty file="${temp.module.folder}/META-INF/context.xml"/> 3.52 - <delete dir="${temp.module.folder}"/> 3.53 - </target> 3.54 - <target name="-check-credentials" if="deploy.ant.enabled" depends="-init"> 3.55 - <fail message="Tomcat password has to be passed as tomcat.password property."> 3.56 - <condition> 3.57 - <not> 3.58 - <isset property="tomcat.password"/> 3.59 - </not> 3.60 - </condition> 3.61 - </fail> 3.62 - </target> 3.63 - <target name="-deploy-ant" if="deploy.ant.enabled" depends="-init,-check-credentials"> 3.64 - <echo message="Deploying ${deploy.ant.archive} to ${Context(path)}"/> 3.65 - <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" 3.66 - classpath="${tomcat.home}/server/lib/catalina-ant.jar"/> 3.67 - <deploy url="${tomcat.url}/manager" username="${tomcat.username}" 3.68 - password="${tomcat.password}" path="${Context(path)}" 3.69 - war="${deploy.ant.archive}"/> 3.70 - <property name="deploy.ant.client.url" value="${tomcat.url}${Context(path)}"/> 3.71 - </target> 3.72 - <target name="-undeploy-ant" if="deploy.ant.enabled" depends="-init,-check-credentials"> 3.73 - <echo message="Undeploying ${Context(path)}"/> 3.74 - <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask" 3.75 - classpath="${tomcat.home}/server/lib/catalina-ant.jar"/> 3.76 - <undeploy url="${tomcat.url}/manager" username="${tomcat.username}" 3.77 - password="${tomcat.password}" path="${Context(path)}"/> 3.78 - </target> 3.79 -</project>
4.1 --- a/nbproject/build-impl.xml Sun Apr 08 16:51:15 2018 +0200 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,1448 +0,0 @@ 4.4 -<?xml version="1.0" encoding="UTF-8"?> 4.5 -<!-- 4.6 - *** GENERATED FROM project.xml - DO NOT EDIT *** 4.7 - *** EDIT ../build.xml INSTEAD *** 4.8 - 4.9 - For the purpose of easier reading the script 4.10 - is divided into following sections: 4.11 - - initialization 4.12 - - compilation 4.13 - - dist 4.14 - - execution 4.15 - - debugging 4.16 - - javadoc 4.17 - - test compilation 4.18 - - test execution 4.19 - - test debugging 4.20 - - cleanup 4.21 - 4.22 - --> 4.23 -<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="LightPIT-impl"> 4.24 - <import file="ant-deploy.xml"/> 4.25 - <fail message="Please build using Ant 1.7.1 or higher."> 4.26 - <condition> 4.27 - <not> 4.28 - <antversion atleast="1.7.1"/> 4.29 - </not> 4.30 - </condition> 4.31 - </fail> 4.32 - <target depends="dist,javadoc" description="Build whole project." name="default"/> 4.33 - <!-- 4.34 - INITIALIZATION SECTION 4.35 - --> 4.36 - <target name="-pre-init"> 4.37 - <!-- Empty placeholder for easier customization. --> 4.38 - <!-- You can override this target in the ../build.xml file. --> 4.39 - </target> 4.40 - <target depends="-pre-init" name="-init-private"> 4.41 - <property file="nbproject/private/private.properties"/> 4.42 - </target> 4.43 - <target depends="-pre-init,-init-private" name="-init-user"> 4.44 - <property file="${user.properties.file}"/> 4.45 - <!-- The two properties below are usually overridden --> 4.46 - <!-- by the active platform. Just a fallback. --> 4.47 - <property name="default.javac.source" value="1.4"/> 4.48 - <property name="default.javac.target" value="1.4"/> 4.49 - </target> 4.50 - <target depends="-pre-init,-init-private,-init-user" name="-init-project"> 4.51 - <property file="nbproject/project.properties"/> 4.52 - </target> 4.53 - <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" if="dist.ear.dir" name="-do-ear-init"/> 4.54 - <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init"> 4.55 - <condition property="have.tests"> 4.56 - <or> 4.57 - <available file="${test.src.dir}"/> 4.58 - </or> 4.59 - </condition> 4.60 - <condition property="have.sources"> 4.61 - <or> 4.62 - <available file="${src.dir}"/> 4.63 - </or> 4.64 - </condition> 4.65 - <condition property="netbeans.home+have.tests"> 4.66 - <and> 4.67 - <isset property="netbeans.home"/> 4.68 - <isset property="have.tests"/> 4.69 - </and> 4.70 - </condition> 4.71 - <condition property="no.javadoc.preview"> 4.72 - <isfalse value="${javadoc.preview}"/> 4.73 - </condition> 4.74 - <property name="javac.compilerargs" value=""/> 4.75 - <condition property="no.deps"> 4.76 - <and> 4.77 - <istrue value="${no.dependencies}"/> 4.78 - </and> 4.79 - </condition> 4.80 - <condition property="no.dist.ear.dir"> 4.81 - <not> 4.82 - <isset property="dist.ear.dir"/> 4.83 - </not> 4.84 - </condition> 4.85 - <property name="build.web.excludes" value="${build.classes.excludes}"/> 4.86 - <condition property="do.compile.jsps"> 4.87 - <istrue value="${compile.jsps}"/> 4.88 - </condition> 4.89 - <condition property="do.debug.server"> 4.90 - <or> 4.91 - <not> 4.92 - <isset property="debug.server"/> 4.93 - </not> 4.94 - <istrue value="${debug.server}"/> 4.95 - <and> 4.96 - <not> 4.97 - <istrue value="${debug.server}"/> 4.98 - </not> 4.99 - <not> 4.100 - <istrue value="${debug.client}"/> 4.101 - </not> 4.102 - </and> 4.103 - </or> 4.104 - </condition> 4.105 - <condition property="do.debug.client"> 4.106 - <istrue value="${debug.client}"/> 4.107 - </condition> 4.108 - <condition property="do.display.browser"> 4.109 - <istrue value="${display.browser}"/> 4.110 - </condition> 4.111 - <condition property="do.display.browser.debug.old"> 4.112 - <and> 4.113 - <isset property="do.display.browser"/> 4.114 - <not> 4.115 - <isset property="do.debug.client"/> 4.116 - </not> 4.117 - <not> 4.118 - <isset property="browser.context"/> 4.119 - </not> 4.120 - </and> 4.121 - </condition> 4.122 - <condition property="do.display.browser.debug"> 4.123 - <and> 4.124 - <isset property="do.display.browser"/> 4.125 - <not> 4.126 - <isset property="do.debug.client"/> 4.127 - </not> 4.128 - <isset property="browser.context"/> 4.129 - </and> 4.130 - </condition> 4.131 - <available file="${conf.dir}/MANIFEST.MF" property="has.custom.manifest"/> 4.132 - <available file="${persistence.xml.dir}/persistence.xml" property="has.persistence.xml"/> 4.133 - <condition property="do.war.package.with.custom.manifest"> 4.134 - <isset property="has.custom.manifest"/> 4.135 - </condition> 4.136 - <condition property="do.war.package.without.custom.manifest"> 4.137 - <not> 4.138 - <isset property="has.custom.manifest"/> 4.139 - </not> 4.140 - </condition> 4.141 - <condition property="do.tmp.war.package.with.custom.manifest"> 4.142 - <and> 4.143 - <isset property="has.custom.manifest"/> 4.144 - <or> 4.145 - <isfalse value="${directory.deployment.supported}"/> 4.146 - <isset property="dist.ear.dir"/> 4.147 - </or> 4.148 - </and> 4.149 - </condition> 4.150 - <condition property="do.tmp.war.package.without.custom.manifest"> 4.151 - <and> 4.152 - <not> 4.153 - <isset property="has.custom.manifest"/> 4.154 - </not> 4.155 - <or> 4.156 - <isfalse value="${directory.deployment.supported}"/> 4.157 - <isset property="dist.ear.dir"/> 4.158 - </or> 4.159 - </and> 4.160 - </condition> 4.161 - <condition property="do.tmp.war.package"> 4.162 - <or> 4.163 - <isfalse value="${directory.deployment.supported}"/> 4.164 - <isset property="dist.ear.dir"/> 4.165 - </or> 4.166 - </condition> 4.167 - <property name="build.meta.inf.dir" value="${build.web.dir}/META-INF"/> 4.168 - <condition else="" property="application.args.param" value="${application.args}"> 4.169 - <and> 4.170 - <isset property="application.args"/> 4.171 - <not> 4.172 - <equals arg1="${application.args}" arg2="" trim="true"/> 4.173 - </not> 4.174 - </and> 4.175 - </condition> 4.176 - <property name="source.encoding" value="${file.encoding}"/> 4.177 - <condition property="javadoc.encoding.used" value="${javadoc.encoding}"> 4.178 - <and> 4.179 - <isset property="javadoc.encoding"/> 4.180 - <not> 4.181 - <equals arg1="${javadoc.encoding}" arg2=""/> 4.182 - </not> 4.183 - </and> 4.184 - </condition> 4.185 - <property name="javadoc.encoding.used" value="${source.encoding}"/> 4.186 - <property name="includes" value="**"/> 4.187 - <property name="excludes" value=""/> 4.188 - <property name="runmain.jvmargs" value=""/> 4.189 - <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> 4.190 - <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> 4.191 - <and> 4.192 - <isset property="endorsed.classpath"/> 4.193 - <length length="0" string="${endorsed.classpath}" when="greater"/> 4.194 - </and> 4.195 - </condition> 4.196 - <condition else="false" property="jdkBug6558476"> 4.197 - <and> 4.198 - <matches pattern="1\.[56]" string="${java.specification.version}"/> 4.199 - <not> 4.200 - <os family="unix"/> 4.201 - </not> 4.202 - </and> 4.203 - </condition> 4.204 - <property name="javac.fork" value="${jdkBug6558476}"/> 4.205 - <condition property="junit.available"> 4.206 - <or> 4.207 - <available classname="org.junit.Test" classpath="${run.test.classpath}"/> 4.208 - <available classname="junit.framework.Test" classpath="${run.test.classpath}"/> 4.209 - </or> 4.210 - </condition> 4.211 - <condition property="testng.available"> 4.212 - <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/> 4.213 - </condition> 4.214 - <condition property="junit+testng.available"> 4.215 - <and> 4.216 - <istrue value="${junit.available}"/> 4.217 - <istrue value="${testng.available}"/> 4.218 - </and> 4.219 - </condition> 4.220 - <condition else="testng" property="testng.mode" value="mixed"> 4.221 - <istrue value="${junit+testng.available}"/> 4.222 - </condition> 4.223 - <condition else="" property="testng.debug.mode" value="-mixed"> 4.224 - <istrue value="${junit+testng.available}"/> 4.225 - </condition> 4.226 - </target> 4.227 - <target depends="init" name="-init-cos" unless="deploy.on.save"> 4.228 - <condition property="deploy.on.save" value="true"> 4.229 - <or> 4.230 - <istrue value="${j2ee.deploy.on.save}"/> 4.231 - <istrue value="${j2ee.compile.on.save}"/> 4.232 - </or> 4.233 - </condition> 4.234 - </target> 4.235 - <target name="-post-init"> 4.236 - <!-- Empty placeholder for easier customization. --> 4.237 - <!-- You can override this target in the ../build.xml file. --> 4.238 - </target> 4.239 - <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check"> 4.240 - <fail unless="src.dir">Must set src.dir</fail> 4.241 - <fail unless="test.src.dir">Must set test.src.dir</fail> 4.242 - <fail unless="build.dir">Must set build.dir</fail> 4.243 - <fail unless="build.web.dir">Must set build.web.dir</fail> 4.244 - <fail unless="build.generated.dir">Must set build.generated.dir</fail> 4.245 - <fail unless="dist.dir">Must set dist.dir</fail> 4.246 - <fail unless="build.classes.dir">Must set build.classes.dir</fail> 4.247 - <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail> 4.248 - <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail> 4.249 - <fail unless="build.test.results.dir">Must set build.test.results.dir</fail> 4.250 - <fail unless="build.classes.excludes">Must set build.classes.excludes</fail> 4.251 - <fail unless="dist.war">Must set dist.war</fail> 4.252 - <condition property="missing.j2ee.server.home"> 4.253 - <and> 4.254 - <matches pattern="j2ee.server.home" string="${j2ee.platform.classpath}"/> 4.255 - <not> 4.256 - <isset property="j2ee.server.home"/> 4.257 - </not> 4.258 - </and> 4.259 - </condition> 4.260 - <fail if="missing.j2ee.server.home"> 4.261 -The Java EE server classpath is not correctly set up - server home directory is missing. 4.262 -Either open the project in the IDE and assign the server or setup the server classpath manually. 4.263 -For example like this: 4.264 - ant -Dj2ee.server.home=<app_server_installation_directory> 4.265 - </fail> 4.266 - <fail unless="j2ee.platform.classpath"> 4.267 -The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. 4.268 -Either open the project in the IDE and assign the server or setup the server classpath manually. 4.269 -For example like this: 4.270 - ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) 4.271 -or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) 4.272 - </fail> 4.273 - </target> 4.274 - <target name="-init-macrodef-property"> 4.275 - <macrodef name="property" uri="http://www.netbeans.org/ns/web-project/1"> 4.276 - <attribute name="name"/> 4.277 - <attribute name="value"/> 4.278 - <sequential> 4.279 - <property name="@{name}" value="${@{value}}"/> 4.280 - </sequential> 4.281 - </macrodef> 4.282 - </target> 4.283 - <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> 4.284 - <macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2"> 4.285 - <attribute default="${src.dir}" name="srcdir"/> 4.286 - <attribute default="${build.classes.dir}" name="destdir"/> 4.287 - <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/> 4.288 - <attribute default="${javac.processorpath}" name="processorpath"/> 4.289 - <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> 4.290 - <attribute default="${includes}" name="includes"/> 4.291 - <attribute default="${excludes}" name="excludes"/> 4.292 - <attribute default="${javac.debug}" name="debug"/> 4.293 - <attribute default="${empty.dir}" name="gensrcdir"/> 4.294 - <element name="customize" optional="true"/> 4.295 - <sequential> 4.296 - <property location="${build.dir}/empty" name="empty.dir"/> 4.297 - <mkdir dir="${empty.dir}"/> 4.298 - <mkdir dir="@{apgeneratedsrcdir}"/> 4.299 - <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}"> 4.300 - <src> 4.301 - <dirset dir="@{gensrcdir}" erroronmissingdir="false"> 4.302 - <include name="*"/> 4.303 - </dirset> 4.304 - </src> 4.305 - <classpath> 4.306 - <path path="@{classpath}"/> 4.307 - </classpath> 4.308 - <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> 4.309 - <compilerarg line="${javac.compilerargs}"/> 4.310 - <compilerarg value="-processorpath"/> 4.311 - <compilerarg path="@{processorpath}:${empty.dir}"/> 4.312 - <compilerarg line="${ap.processors.internal}"/> 4.313 - <compilerarg value="-s"/> 4.314 - <compilerarg path="@{apgeneratedsrcdir}"/> 4.315 - <compilerarg line="${ap.proc.none.internal}"/> 4.316 - <customize/> 4.317 - </javac> 4.318 - </sequential> 4.319 - </macrodef> 4.320 - </target> 4.321 - <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> 4.322 - <macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2"> 4.323 - <attribute default="${src.dir}" name="srcdir"/> 4.324 - <attribute default="${build.classes.dir}" name="destdir"/> 4.325 - <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/> 4.326 - <attribute default="${javac.processorpath}" name="processorpath"/> 4.327 - <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> 4.328 - <attribute default="${includes}" name="includes"/> 4.329 - <attribute default="${excludes}" name="excludes"/> 4.330 - <attribute default="${javac.debug}" name="debug"/> 4.331 - <attribute default="${empty.dir}" name="gensrcdir"/> 4.332 - <element name="customize" optional="true"/> 4.333 - <sequential> 4.334 - <property location="${build.dir}/empty" name="empty.dir"/> 4.335 - <mkdir dir="${empty.dir}"/> 4.336 - <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}"> 4.337 - <src> 4.338 - <dirset dir="@{gensrcdir}" erroronmissingdir="false"> 4.339 - <include name="*"/> 4.340 - </dirset> 4.341 - </src> 4.342 - <classpath> 4.343 - <path path="@{classpath}"/> 4.344 - </classpath> 4.345 - <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> 4.346 - <compilerarg line="${javac.compilerargs}"/> 4.347 - <customize/> 4.348 - </javac> 4.349 - </sequential> 4.350 - </macrodef> 4.351 - </target> 4.352 - <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> 4.353 - <macrodef name="depend" uri="http://www.netbeans.org/ns/web-project/2"> 4.354 - <attribute default="${src.dir}" name="srcdir"/> 4.355 - <attribute default="${build.classes.dir}" name="destdir"/> 4.356 - <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/> 4.357 - <sequential> 4.358 - <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}"> 4.359 - <classpath> 4.360 - <path path="@{classpath}"/> 4.361 - </classpath> 4.362 - </depend> 4.363 - </sequential> 4.364 - </macrodef> 4.365 - <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/web-project/2"> 4.366 - <attribute default="${build.classes.dir}" name="destdir"/> 4.367 - <sequential> 4.368 - <fail unless="javac.includes">Must set javac.includes</fail> 4.369 - <pathconvert pathsep="${line.separator}" property="javac.includes.binary"> 4.370 - <path> 4.371 - <filelist dir="@{destdir}" files="${javac.includes}"/> 4.372 - </path> 4.373 - <globmapper from="*.java" to="*.class"/> 4.374 - </pathconvert> 4.375 - <tempfile deleteonexit="true" property="javac.includesfile.binary"/> 4.376 - <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/> 4.377 - <delete> 4.378 - <files includesfile="${javac.includesfile.binary}"/> 4.379 - </delete> 4.380 - <delete file="${javac.includesfile.binary}"/> 4.381 - </sequential> 4.382 - </macrodef> 4.383 - </target> 4.384 - <target if="${junit.available}" name="-init-macrodef-junit-init"> 4.385 - <condition else="false" property="nb.junit.batch" value="true"> 4.386 - <and> 4.387 - <istrue value="${junit.available}"/> 4.388 - <not> 4.389 - <isset property="test.method"/> 4.390 - </not> 4.391 - </and> 4.392 - </condition> 4.393 - <condition else="false" property="nb.junit.single" value="true"> 4.394 - <and> 4.395 - <istrue value="${junit.available}"/> 4.396 - <isset property="test.method"/> 4.397 - </and> 4.398 - </condition> 4.399 - </target> 4.400 - <target name="-init-test-properties"> 4.401 - <property name="test.binaryincludes" value="<nothing>"/> 4.402 - <property name="test.binarytestincludes" value=""/> 4.403 - <property name="test.binaryexcludes" value=""/> 4.404 - </target> 4.405 - <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}"> 4.406 - <macrodef name="junit" uri="http://www.netbeans.org/ns/web-project/2"> 4.407 - <attribute default="${includes}" name="includes"/> 4.408 - <attribute default="${excludes}" name="excludes"/> 4.409 - <attribute default="**" name="testincludes"/> 4.410 - <attribute default="" name="testmethods"/> 4.411 - <element name="customize" optional="true"/> 4.412 - <sequential> 4.413 - <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${java.io.tmpdir}"> 4.414 - <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> 4.415 - <syspropertyset> 4.416 - <propertyref prefix="test-sys-prop."/> 4.417 - <mapper from="test-sys-prop.*" to="*" type="glob"/> 4.418 - </syspropertyset> 4.419 - <formatter type="brief" usefile="false"/> 4.420 - <formatter type="xml"/> 4.421 - <jvmarg value="-ea"/> 4.422 - <customize/> 4.423 - </junit> 4.424 - </sequential> 4.425 - </macrodef> 4.426 - </target> 4.427 - <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}"> 4.428 - <macrodef name="junit" uri="http://www.netbeans.org/ns/web-project/2"> 4.429 - <attribute default="${includes}" name="includes"/> 4.430 - <attribute default="${excludes}" name="excludes"/> 4.431 - <attribute default="**" name="testincludes"/> 4.432 - <attribute default="" name="testmethods"/> 4.433 - <element name="customize" optional="true"/> 4.434 - <sequential> 4.435 - <property name="run.jvmargs.ide" value=""/> 4.436 - <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}"> 4.437 - <batchtest todir="${build.test.results.dir}"> 4.438 - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> 4.439 - <filename name="@{testincludes}"/> 4.440 - </fileset> 4.441 - <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> 4.442 - <filename name="${test.binarytestincludes}"/> 4.443 - </fileset> 4.444 - </batchtest> 4.445 - <syspropertyset> 4.446 - <propertyref prefix="test-sys-prop."/> 4.447 - <mapper from="test-sys-prop.*" to="*" type="glob"/> 4.448 - </syspropertyset> 4.449 - <formatter type="brief" usefile="false"/> 4.450 - <formatter type="xml"/> 4.451 - <jvmarg value="-ea"/> 4.452 - <jvmarg line="${run.jvmargs.ide}"/> 4.453 - <customize/> 4.454 - </junit> 4.455 - </sequential> 4.456 - </macrodef> 4.457 - </target> 4.458 - <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/> 4.459 - <target if="${testng.available}" name="-init-macrodef-testng"> 4.460 - <macrodef name="testng" uri="http://www.netbeans.org/ns/web-project/2"> 4.461 - <attribute default="${includes}" name="includes"/> 4.462 - <attribute default="${excludes}" name="excludes"/> 4.463 - <attribute default="**" name="testincludes"/> 4.464 - <attribute default="" name="testmethods"/> 4.465 - <element name="customize" optional="true"/> 4.466 - <sequential> 4.467 - <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}"> 4.468 - <isset property="test.method"/> 4.469 - </condition> 4.470 - <union id="test.set"> 4.471 - <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}"> 4.472 - <filename name="@{testincludes}"/> 4.473 - </fileset> 4.474 - </union> 4.475 - <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> 4.476 - <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="LightPIT" testname="TestNG tests" workingDir="${basedir}"> 4.477 - <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> 4.478 - <propertyset> 4.479 - <propertyref prefix="test-sys-prop."/> 4.480 - <mapper from="test-sys-prop.*" to="*" type="glob"/> 4.481 - </propertyset> 4.482 - <customize/> 4.483 - </testng> 4.484 - </sequential> 4.485 - </macrodef> 4.486 - </target> 4.487 - <target name="-init-macrodef-test-impl"> 4.488 - <macrodef name="test-impl" uri="http://www.netbeans.org/ns/web-project/2"> 4.489 - <attribute default="${includes}" name="includes"/> 4.490 - <attribute default="${excludes}" name="excludes"/> 4.491 - <attribute default="**" name="testincludes"/> 4.492 - <attribute default="" name="testmethods"/> 4.493 - <element implicit="true" name="customize" optional="true"/> 4.494 - <sequential> 4.495 - <echo>No tests executed.</echo> 4.496 - </sequential> 4.497 - </macrodef> 4.498 - </target> 4.499 - <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl"> 4.500 - <macrodef name="test-impl" uri="http://www.netbeans.org/ns/web-project/2"> 4.501 - <attribute default="${includes}" name="includes"/> 4.502 - <attribute default="${excludes}" name="excludes"/> 4.503 - <attribute default="**" name="testincludes"/> 4.504 - <attribute default="" name="testmethods"/> 4.505 - <element implicit="true" name="customize" optional="true"/> 4.506 - <sequential> 4.507 - <webproject2:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> 4.508 - <customize/> 4.509 - </webproject2:junit> 4.510 - </sequential> 4.511 - </macrodef> 4.512 - </target> 4.513 - <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl"> 4.514 - <macrodef name="test-impl" uri="http://www.netbeans.org/ns/web-project/2"> 4.515 - <attribute default="${includes}" name="includes"/> 4.516 - <attribute default="${excludes}" name="excludes"/> 4.517 - <attribute default="**" name="testincludes"/> 4.518 - <attribute default="" name="testmethods"/> 4.519 - <element implicit="true" name="customize" optional="true"/> 4.520 - <sequential> 4.521 - <webproject2:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> 4.522 - <customize/> 4.523 - </webproject2:testng> 4.524 - </sequential> 4.525 - </macrodef> 4.526 - </target> 4.527 - <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test"> 4.528 - <macrodef name="test" uri="http://www.netbeans.org/ns/web-project/2"> 4.529 - <attribute default="${includes}" name="includes"/> 4.530 - <attribute default="${excludes}" name="excludes"/> 4.531 - <attribute default="**" name="testincludes"/> 4.532 - <attribute default="" name="testmethods"/> 4.533 - <sequential> 4.534 - <webproject2:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> 4.535 - <customize> 4.536 - <classpath> 4.537 - <path path="${run.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}"/> 4.538 - </classpath> 4.539 - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> 4.540 - <jvmarg line="${runmain.jvmargs}"/> 4.541 - </customize> 4.542 - </webproject2:test-impl> 4.543 - </sequential> 4.544 - </macrodef> 4.545 - </target> 4.546 - <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}"> 4.547 - <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/web-project/2"> 4.548 - <attribute default="${includes}" name="includes"/> 4.549 - <attribute default="${excludes}" name="excludes"/> 4.550 - <attribute default="**" name="testincludes"/> 4.551 - <attribute default="" name="testmethods"/> 4.552 - <element name="customize" optional="true"/> 4.553 - <sequential> 4.554 - <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${java.io.tmpdir}"> 4.555 - <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> 4.556 - <syspropertyset> 4.557 - <propertyref prefix="test-sys-prop."/> 4.558 - <mapper from="test-sys-prop.*" to="*" type="glob"/> 4.559 - </syspropertyset> 4.560 - <formatter type="brief" usefile="false"/> 4.561 - <formatter type="xml"/> 4.562 - <jvmarg value="-ea"/> 4.563 - <jvmarg line="${debug-args-line}"/> 4.564 - <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> 4.565 - <customize/> 4.566 - </junit> 4.567 - </sequential> 4.568 - </macrodef> 4.569 - </target> 4.570 - <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch"> 4.571 - <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/web-project/2"> 4.572 - <attribute default="${includes}" name="includes"/> 4.573 - <attribute default="${excludes}" name="excludes"/> 4.574 - <attribute default="**" name="testincludes"/> 4.575 - <attribute default="" name="testmethods"/> 4.576 - <element name="customize" optional="true"/> 4.577 - <sequential> 4.578 - <property name="run.jvmargs.ide" value=""/> 4.579 - <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}"> 4.580 - <batchtest todir="${build.test.results.dir}"> 4.581 - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> 4.582 - <filename name="@{testincludes}"/> 4.583 - </fileset> 4.584 - <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> 4.585 - <filename name="${test.binarytestincludes}"/> 4.586 - </fileset> 4.587 - </batchtest> 4.588 - <syspropertyset> 4.589 - <propertyref prefix="test-sys-prop."/> 4.590 - <mapper from="test-sys-prop.*" to="*" type="glob"/> 4.591 - </syspropertyset> 4.592 - <formatter type="brief" usefile="false"/> 4.593 - <formatter type="xml"/> 4.594 - <jvmarg value="-ea"/> 4.595 - <jvmarg line="${run.jvmargs.ide}"/> 4.596 - <jvmarg line="${debug-args-line}"/> 4.597 - <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> 4.598 - <customize/> 4.599 - </junit> 4.600 - </sequential> 4.601 - </macrodef> 4.602 - </target> 4.603 - <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl"> 4.604 - <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/web-project/2"> 4.605 - <attribute default="${includes}" name="includes"/> 4.606 - <attribute default="${excludes}" name="excludes"/> 4.607 - <attribute default="**" name="testincludes"/> 4.608 - <attribute default="" name="testmethods"/> 4.609 - <element implicit="true" name="customize" optional="true"/> 4.610 - <sequential> 4.611 - <webproject2:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> 4.612 - <customize/> 4.613 - </webproject2:junit-debug> 4.614 - </sequential> 4.615 - </macrodef> 4.616 - </target> 4.617 - <target if="${testng.available}" name="-init-macrodef-testng-debug"> 4.618 - <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/web-project/2"> 4.619 - <attribute default="${main.class}" name="testClass"/> 4.620 - <attribute default="" name="testMethod"/> 4.621 - <element name="customize2" optional="true"/> 4.622 - <sequential> 4.623 - <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}"> 4.624 - <isset property="test.method"/> 4.625 - </condition> 4.626 - <condition else="-suitename LightPIT -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}"> 4.627 - <matches pattern=".*\.xml" string="@{testClass}"/> 4.628 - </condition> 4.629 - <delete dir="${build.test.results.dir}" quiet="true"/> 4.630 - <mkdir dir="${build.test.results.dir}"/> 4.631 - <webproject1:debug args="${testng.cmd.args}" classname="org.testng.TestNG" classpath="${debug.test.classpath}:${j2ee.platform.embeddableejb.classpath}"> 4.632 - <customize> 4.633 - <customize2/> 4.634 - <jvmarg value="-ea"/> 4.635 - <arg line="${testng.debug.mode}"/> 4.636 - <arg line="-d ${build.test.results.dir}"/> 4.637 - <arg line="-listener org.testng.reporters.VerboseReporter"/> 4.638 - </customize> 4.639 - </webproject1:debug> 4.640 - </sequential> 4.641 - </macrodef> 4.642 - </target> 4.643 - <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl"> 4.644 - <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/web-project/2"> 4.645 - <attribute default="${main.class}" name="testClass"/> 4.646 - <attribute default="" name="testMethod"/> 4.647 - <element implicit="true" name="customize2" optional="true"/> 4.648 - <sequential> 4.649 - <webproject2:testng-debug testClass="@{testClass}" testMethod="@{testMethod}"> 4.650 - <customize2/> 4.651 - </webproject2:testng-debug> 4.652 - </sequential> 4.653 - </macrodef> 4.654 - </target> 4.655 - <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit"> 4.656 - <macrodef name="test-debug" uri="http://www.netbeans.org/ns/web-project/2"> 4.657 - <attribute default="${includes}" name="includes"/> 4.658 - <attribute default="${excludes}" name="excludes"/> 4.659 - <attribute default="**" name="testincludes"/> 4.660 - <attribute default="" name="testmethods"/> 4.661 - <attribute default="${main.class}" name="testClass"/> 4.662 - <attribute default="" name="testMethod"/> 4.663 - <sequential> 4.664 - <webproject2:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> 4.665 - <customize> 4.666 - <classpath> 4.667 - <path path="${run.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}"/> 4.668 - </classpath> 4.669 - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> 4.670 - <jvmarg line="${runmain.jvmargs}"/> 4.671 - </customize> 4.672 - </webproject2:test-debug-impl> 4.673 - </sequential> 4.674 - </macrodef> 4.675 - </target> 4.676 - <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng"> 4.677 - <macrodef name="test-debug" uri="http://www.netbeans.org/ns/web-project/2"> 4.678 - <attribute default="${includes}" name="includes"/> 4.679 - <attribute default="${excludes}" name="excludes"/> 4.680 - <attribute default="**" name="testincludes"/> 4.681 - <attribute default="" name="testmethods"/> 4.682 - <attribute default="${main.class}" name="testClass"/> 4.683 - <attribute default="" name="testMethod"/> 4.684 - <sequential> 4.685 - <webproject2:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}"> 4.686 - <customize2> 4.687 - <syspropertyset> 4.688 - <propertyref prefix="test-sys-prop."/> 4.689 - <mapper from="test-sys-prop.*" to="*" type="glob"/> 4.690 - </syspropertyset> 4.691 - </customize2> 4.692 - </webproject2:testng-debug-impl> 4.693 - </sequential> 4.694 - </macrodef> 4.695 - </target> 4.696 - <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/> 4.697 - <target name="-init-macrodef-java"> 4.698 - <macrodef name="java" uri="http://www.netbeans.org/ns/web-project/1"> 4.699 - <attribute default="${main.class}" name="classname"/> 4.700 - <attribute default="${debug.classpath}" name="classpath"/> 4.701 - <element name="customize" optional="true"/> 4.702 - <sequential> 4.703 - <java classname="@{classname}" fork="true"> 4.704 - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> 4.705 - <jvmarg line="${runmain.jvmargs}"/> 4.706 - <classpath> 4.707 - <path path="@{classpath}:${j2ee.platform.classpath}"/> 4.708 - </classpath> 4.709 - <syspropertyset> 4.710 - <propertyref prefix="run-sys-prop."/> 4.711 - <mapper from="run-sys-prop.*" to="*" type="glob"/> 4.712 - </syspropertyset> 4.713 - <customize/> 4.714 - </java> 4.715 - </sequential> 4.716 - </macrodef> 4.717 - </target> 4.718 - <target name="-init-macrodef-nbjsdebug"> 4.719 - <macrodef name="nbjsdebugstart" uri="http://www.netbeans.org/ns/web-project/1"> 4.720 - <attribute default="${client.url}" name="webUrl"/> 4.721 - <sequential> 4.722 - <nbjsdebugstart urlPart="${client.urlPart}" webUrl="@{webUrl}"/> 4.723 - </sequential> 4.724 - </macrodef> 4.725 - </target> 4.726 - <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> 4.727 - <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/web-project/1"> 4.728 - <attribute default="${main.class}" name="name"/> 4.729 - <attribute default="${debug.classpath}:${j2ee.platform.classpath}" name="classpath"/> 4.730 - <sequential> 4.731 - <nbjpdastart addressproperty="jpda.address" name="@{name}" transport="${debug-transport}"> 4.732 - <classpath> 4.733 - <path path="@{classpath}"/> 4.734 - </classpath> 4.735 - </nbjpdastart> 4.736 - </sequential> 4.737 - </macrodef> 4.738 - <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/web-project/1"> 4.739 - <attribute default="${build.classes.dir}" name="dir"/> 4.740 - <sequential> 4.741 - <nbjpdareload> 4.742 - <fileset dir="@{dir}" includes="${fix.classes}"> 4.743 - <include name="${fix.includes}*.class"/> 4.744 - </fileset> 4.745 - </nbjpdareload> 4.746 - </sequential> 4.747 - </macrodef> 4.748 - <macrodef name="nbjpdaappreloaded" uri="http://www.netbeans.org/ns/web-project/1"> 4.749 - <sequential> 4.750 - <nbjpdaappreloaded/> 4.751 - </sequential> 4.752 - </macrodef> 4.753 - </target> 4.754 - <target name="-init-debug-args"> 4.755 - <property name="version-output" value="java version "${ant.java.version}"/> 4.756 - <condition property="have-jdk-older-than-1.4"> 4.757 - <or> 4.758 - <contains string="${version-output}" substring="java version "1.0"/> 4.759 - <contains string="${version-output}" substring="java version "1.1"/> 4.760 - <contains string="${version-output}" substring="java version "1.2"/> 4.761 - <contains string="${version-output}" substring="java version "1.3"/> 4.762 - </or> 4.763 - </condition> 4.764 - <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none"> 4.765 - <istrue value="${have-jdk-older-than-1.4}"/> 4.766 - </condition> 4.767 - <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem"> 4.768 - <os family="windows"/> 4.769 - </condition> 4.770 - <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}"> 4.771 - <isset property="debug.transport"/> 4.772 - </condition> 4.773 - </target> 4.774 - <target depends="-init-debug-args" name="-init-macrodef-debug"> 4.775 - <macrodef name="debug" uri="http://www.netbeans.org/ns/web-project/1"> 4.776 - <attribute default="${main.class}" name="classname"/> 4.777 - <attribute default="${debug.classpath}:${j2ee.platform.classpath}" name="classpath"/> 4.778 - <attribute default="${application.args.param}" name="args"/> 4.779 - <element name="customize" optional="true"/> 4.780 - <sequential> 4.781 - <java classname="@{classname}" fork="true"> 4.782 - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> 4.783 - <jvmarg line="${debug-args-line}"/> 4.784 - <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> 4.785 - <jvmarg line="${runmain.jvmargs}"/> 4.786 - <classpath> 4.787 - <path path="@{classpath}"/> 4.788 - </classpath> 4.789 - <syspropertyset> 4.790 - <propertyref prefix="run-sys-prop."/> 4.791 - <mapper from="run-sys-prop.*" to="*" type="glob"/> 4.792 - </syspropertyset> 4.793 - <arg line="@{args}"/> 4.794 - <customize/> 4.795 - </java> 4.796 - </sequential> 4.797 - </macrodef> 4.798 - </target> 4.799 - <target name="-init-taskdefs"> 4.800 - <fail unless="libs.CopyLibs.classpath"> 4.801 -The libs.CopyLibs.classpath property is not set up. 4.802 -This property must point to 4.803 -org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part 4.804 -of NetBeans IDE installation and is usually located at 4.805 -<netbeans_installation>/java<version>/ant/extra folder. 4.806 -Either open the project in the IDE and make sure CopyLibs library 4.807 -exists or setup the property manually. For example like this: 4.808 - ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar 4.809 - </fail> 4.810 - <taskdef classpath="${libs.CopyLibs.classpath}" resource="org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml"/> 4.811 - </target> 4.812 - <target name="-init-ap-cmdline-properties"> 4.813 - <property name="annotation.processing.enabled" value="true"/> 4.814 - <property name="annotation.processing.processors.list" value=""/> 4.815 - <property name="annotation.processing.run.all.processors" value="true"/> 4.816 - <property name="javac.processorpath" value="${javac.classpath}"/> 4.817 - <property name="javac.test.processorpath" value="${javac.test.classpath}"/> 4.818 - <condition property="ap.supported.internal" value="true"> 4.819 - <not> 4.820 - <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> 4.821 - </not> 4.822 - </condition> 4.823 - </target> 4.824 - <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> 4.825 - <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> 4.826 - <isfalse value="${annotation.processing.run.all.processors}"/> 4.827 - </condition> 4.828 - <condition else="" property="ap.proc.none.internal" value="-proc:none"> 4.829 - <isfalse value="${annotation.processing.enabled}"/> 4.830 - </condition> 4.831 - </target> 4.832 - <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> 4.833 - <property name="ap.cmd.line.internal" value=""/> 4.834 - </target> 4.835 - <!-- 4.836 - pre NB7.2 profiling section; consider it deprecated 4.837 - --> 4.838 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/> 4.839 - <target if="profiler.info.jvmargs.agent" name="-profile-pre-init"> 4.840 - <!-- Empty placeholder for easier customization. --> 4.841 - <!-- You can override this target in the ../build.xml file. --> 4.842 - </target> 4.843 - <target if="profiler.info.jvmargs.agent" name="-profile-post-init"> 4.844 - <!-- Empty placeholder for easier customization. --> 4.845 - <!-- You can override this target in the ../build.xml file. --> 4.846 - </target> 4.847 - <target depends="-profile-pre-init, init, -profile-post-init" if="profiler.info.jvmargs.agent" name="-profile-init-check"> 4.848 - <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> 4.849 - <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> 4.850 - </target> 4.851 - <!-- 4.852 - end of pre NB7.2 profiling section 4.853 - --> 4.854 - <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-nbjsdebug,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline" name="init"/> 4.855 - <!-- 4.856 - COMPILATION SECTION 4.857 - --> 4.858 - <target depends="init" if="no.dist.ear.dir" name="deps-module-jar" unless="no.deps"/> 4.859 - <target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps"/> 4.860 - <target depends="init, deps-module-jar, deps-ear-jar" name="deps-jar" unless="no.deps"/> 4.861 - <target depends="init,deps-jar" name="-pre-pre-compile"> 4.862 - <mkdir dir="${build.classes.dir}"/> 4.863 - </target> 4.864 - <target name="-pre-compile"> 4.865 - <!-- Empty placeholder for easier customization. --> 4.866 - <!-- You can override this target in the ../build.xml file. --> 4.867 - </target> 4.868 - <target name="-copy-webdir"> 4.869 - <copy todir="${build.web.dir}"> 4.870 - <fileset dir="${web.docbase.dir}" excludes="${build.web.excludes},${excludes}" includes="${includes}"/> 4.871 - </copy> 4.872 - <copy todir="${build.web.dir}/WEB-INF"> 4.873 - <fileset dir="${webinf.dir}" excludes="${build.web.excludes}"/> 4.874 - </copy> 4.875 - </target> 4.876 - <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"> 4.877 - <webproject2:javac destdir="${build.classes.dir}" gensrcdir="${build.generated.sources.dir}"/> 4.878 - <copy todir="${build.classes.dir}"> 4.879 - <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> 4.880 - </copy> 4.881 - </target> 4.882 - <target if="has.custom.manifest" name="-copy-manifest"> 4.883 - <mkdir dir="${build.meta.inf.dir}"/> 4.884 - <copy todir="${build.meta.inf.dir}"> 4.885 - <fileset dir="${conf.dir}" includes="MANIFEST.MF"/> 4.886 - </copy> 4.887 - </target> 4.888 - <target if="has.persistence.xml" name="-copy-persistence-xml"> 4.889 - <mkdir dir="${build.web.dir}/WEB-INF/classes/META-INF"/> 4.890 - <copy todir="${build.web.dir}/WEB-INF/classes/META-INF"> 4.891 - <fileset dir="${persistence.xml.dir}" includes="persistence.xml orm.xml"/> 4.892 - </copy> 4.893 - </target> 4.894 - <target name="-post-compile"> 4.895 - <!-- Empty placeholder for easier customization. --> 4.896 - <!-- You can override this target in the ../build.xml file. --> 4.897 - </target> 4.898 - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/> 4.899 - <target name="-pre-compile-single"> 4.900 - <!-- Empty placeholder for easier customization. --> 4.901 - <!-- You can override this target in the ../build.xml file. --> 4.902 - </target> 4.903 - <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> 4.904 - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> 4.905 - <webproject2:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}"/> 4.906 - <copy todir="${build.classes.dir}"> 4.907 - <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> 4.908 - </copy> 4.909 - </target> 4.910 - <target name="-post-compile-single"> 4.911 - <!-- Empty placeholder for easier customization. --> 4.912 - <!-- You can override this target in the ../build.xml file. --> 4.913 - </target> 4.914 - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/> 4.915 - <property name="jspc.schemas" value="/resources/schemas/"/> 4.916 - <property name="jspc.dtds" value="/resources/dtds/"/> 4.917 - <target depends="compile" description="Test compile JSP pages to expose compilation errors." if="do.compile.jsps" name="compile-jsps"> 4.918 - <mkdir dir="${build.generated.dir}/src"/> 4.919 - <java classname="org.netbeans.modules.web.project.ant.JspC" failonerror="true" fork="true"> 4.920 - <arg value="-uriroot"/> 4.921 - <arg file="${basedir}/${build.web.dir}"/> 4.922 - <arg value="-d"/> 4.923 - <arg file="${basedir}/${build.generated.dir}/src"/> 4.924 - <arg value="-die1"/> 4.925 - <arg value="-schemas ${jspc.schemas}"/> 4.926 - <arg value="-dtds ${jspc.dtds}"/> 4.927 - <arg value="-compilerSourceVM ${javac.source}"/> 4.928 - <arg value="-compilerTargetVM ${javac.target}"/> 4.929 - <arg value="-javaEncoding ${source.encoding}"/> 4.930 - <arg value="-sysClasspath ${libs.jsp-compilation-syscp.classpath}"/> 4.931 - <classpath path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/> 4.932 - </java> 4.933 - <mkdir dir="${build.generated.dir}/classes"/> 4.934 - <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"/> 4.935 - </target> 4.936 - <target depends="compile" if="jsp.includes" name="-do-compile-single-jsp"> 4.937 - <fail unless="javac.jsp.includes">Must select some files in the IDE or set javac.jsp.includes</fail> 4.938 - <mkdir dir="${build.generated.dir}/src"/> 4.939 - <java classname="org.netbeans.modules.web.project.ant.JspCSingle" failonerror="true" fork="true"> 4.940 - <arg value="-uriroot"/> 4.941 - <arg file="${basedir}/${build.web.dir}"/> 4.942 - <arg value="-d"/> 4.943 - <arg file="${basedir}/${build.generated.dir}/src"/> 4.944 - <arg value="-die1"/> 4.945 - <arg value="-schemas ${jspc.schemas}"/> 4.946 - <arg value="-dtds ${jspc.dtds}"/> 4.947 - <arg value="-sysClasspath ${libs.jsp-compilation-syscp.classpath}"/> 4.948 - <arg value="-jspc.files"/> 4.949 - <arg path="${jsp.includes}"/> 4.950 - <arg value="-compilerSourceVM ${javac.source}"/> 4.951 - <arg value="-compilerTargetVM ${javac.target}"/> 4.952 - <arg value="-javaEncoding ${source.encoding}"/> 4.953 - <classpath path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/> 4.954 - </java> 4.955 - <mkdir dir="${build.generated.dir}/classes"/> 4.956 - <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"> 4.957 - <customize> 4.958 - <patternset includes="${javac.jsp.includes}"/> 4.959 - </customize> 4.960 - </webproject2:javac> 4.961 - </target> 4.962 - <target name="compile-single-jsp"> 4.963 - <fail unless="jsp.includes">Must select a file in the IDE or set jsp.includes</fail> 4.964 - <antcall target="-do-compile-single-jsp"/> 4.965 - </target> 4.966 - <!-- 4.967 - DIST BUILDING SECTION 4.968 - --> 4.969 - <target name="-pre-dist"> 4.970 - <!-- Empty placeholder for easier customization. --> 4.971 - <!-- You can override this target in the ../build.xml file. --> 4.972 - </target> 4.973 - <target depends="init,compile,compile-jsps,-pre-dist" if="do.war.package.without.custom.manifest" name="-do-dist-without-manifest"> 4.974 - <dirname file="${dist.war}" property="dist.jar.dir"/> 4.975 - <mkdir dir="${dist.jar.dir}"/> 4.976 - <jar compress="${jar.compress}" jarfile="${dist.war}"> 4.977 - <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> 4.978 - </jar> 4.979 - </target> 4.980 - <target depends="init,compile,compile-jsps,-pre-dist" if="do.war.package.with.custom.manifest" name="-do-dist-with-manifest"> 4.981 - <dirname file="${dist.war}" property="dist.jar.dir"/> 4.982 - <mkdir dir="${dist.jar.dir}"/> 4.983 - <jar compress="${jar.compress}" jarfile="${dist.war}" manifest="${build.meta.inf.dir}/MANIFEST.MF"> 4.984 - <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> 4.985 - </jar> 4.986 - </target> 4.987 - <target depends="init,compile,compile-jsps,-pre-dist" if="do.tmp.war.package.without.custom.manifest" name="-do-tmp-dist-without-manifest"> 4.988 - <dirname file="${dist.war}" property="dist.jar.dir"/> 4.989 - <mkdir dir="${dist.jar.dir}"/> 4.990 - <jar compress="${jar.compress}" jarfile="${dist.war}"> 4.991 - <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> 4.992 - </jar> 4.993 - </target> 4.994 - <target depends="init,compile,compile-jsps,-pre-dist" if="do.tmp.war.package.with.custom.manifest" name="-do-tmp-dist-with-manifest"> 4.995 - <dirname file="${dist.war}" property="dist.jar.dir"/> 4.996 - <mkdir dir="${dist.jar.dir}"/> 4.997 - <jar compress="${jar.compress}" jarfile="${dist.war}" manifest="${build.meta.inf.dir}/MANIFEST.MF"> 4.998 - <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> 4.999 - </jar> 4.1000 - </target> 4.1001 - <target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/> 4.1002 - <target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest"> 4.1003 - <copyfiles files="${libs.jstl.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> 4.1004 - <copyfiles files="${libs.SLF4J-LOG4J2.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> 4.1005 - <copyfiles files="${libs.LOG4J2-WEB.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> 4.1006 - <mkdir dir="${build.web.dir}/META-INF"/> 4.1007 - <manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/> 4.1008 - </target> 4.1009 - <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir"> 4.1010 - <copyfiles files="${libs.jstl.classpath}" todir="${build.web.dir}/WEB-INF/lib"/> 4.1011 - <copyfiles files="${libs.SLF4J-LOG4J2.classpath}" todir="${build.web.dir}/WEB-INF/lib"/> 4.1012 - <copyfiles files="${libs.LOG4J2-WEB.classpath}" todir="${build.web.dir}/WEB-INF/lib"/> 4.1013 - </target> 4.1014 - <target depends="init" if="dist.ear.dir" name="-clean-webinf-lib"> 4.1015 - <delete dir="${build.web.dir}/WEB-INF/lib"/> 4.1016 - </target> 4.1017 - <target depends="init,-clean-webinf-lib,compile,compile-jsps,-pre-dist,library-inclusion-in-manifest" if="do.tmp.war.package" name="do-ear-dist"> 4.1018 - <dirname file="${dist.ear.war}" property="dist.jar.dir"/> 4.1019 - <mkdir dir="${dist.jar.dir}"/> 4.1020 - <jar compress="${jar.compress}" jarfile="${dist.ear.war}" manifest="${build.web.dir}/META-INF/MANIFEST.MF"> 4.1021 - <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> 4.1022 - </jar> 4.1023 - </target> 4.1024 - <target name="-post-dist"> 4.1025 - <!-- Empty placeholder for easier customization. --> 4.1026 - <!-- You can override this target in the ../build.xml file. --> 4.1027 - </target> 4.1028 - <target depends="init,compile,-pre-dist,do-dist,-post-dist" description="Build distribution (WAR)." name="dist"/> 4.1029 - <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"/> 4.1030 - <!-- 4.1031 - EXECUTION SECTION 4.1032 - --> 4.1033 - <target depends="run-deploy,run-display-browser" description="Deploy to server and show in browser." name="run"/> 4.1034 - <target name="-pre-run-deploy"> 4.1035 - <!-- Empty placeholder for easier customization. --> 4.1036 - <!-- You can override this target in the ../build.xml file. --> 4.1037 - </target> 4.1038 - <target name="-post-run-deploy"> 4.1039 - <!-- Empty placeholder for easier customization. --> 4.1040 - <!-- You can override this target in the ../build.xml file. --> 4.1041 - </target> 4.1042 - <target name="-pre-nbmodule-run-deploy"> 4.1043 - <!-- Empty placeholder for easier customization. --> 4.1044 - <!-- This target can be overriden by NetBeans modules. Don't override it directly, use -pre-run-deploy task instead. --> 4.1045 - </target> 4.1046 - <target name="-post-nbmodule-run-deploy"> 4.1047 - <!-- Empty placeholder for easier customization. --> 4.1048 - <!-- This target can be overriden by NetBeans modules. Don't override it directly, use -post-run-deploy task instead. --> 4.1049 - </target> 4.1050 - <target name="-run-deploy-am"> 4.1051 - <!-- Task to deploy to the Access Manager runtime. --> 4.1052 - </target> 4.1053 - <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,-do-update-breakpoints" name="run-deploy"/> 4.1054 - <target if="netbeans.home" name="-run-deploy-nb"> 4.1055 - <nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/> 4.1056 - </target> 4.1057 - <target name="-init-deploy-ant" unless="netbeans.home"> 4.1058 - <property name="deploy.ant.archive" value="${dist.war}"/> 4.1059 - <property name="deploy.ant.docbase.dir" value="${web.docbase.dir}"/> 4.1060 - <property name="deploy.ant.resource.dir" value="${resource.dir}"/> 4.1061 - <property name="deploy.ant.enabled" value="true"/> 4.1062 - </target> 4.1063 - <target depends="dist,-run-undeploy-nb,-init-deploy-ant,-undeploy-ant" name="run-undeploy"/> 4.1064 - <target if="netbeans.home" name="-run-undeploy-nb"> 4.1065 - <fail message="Undeploy is not supported from within the IDE"/> 4.1066 - </target> 4.1067 - <target depends="init,-pre-dist,dist,-post-dist" name="verify"> 4.1068 - <nbverify file="${dist.war}"/> 4.1069 - </target> 4.1070 - <target depends="run-deploy,-init-display-browser,-display-browser-nb-old,-display-browser-nb,-display-browser-cl" name="run-display-browser"/> 4.1071 - <target if="do.display.browser" name="-init-display-browser"> 4.1072 - <condition property="do.display.browser.nb.old"> 4.1073 - <and> 4.1074 - <isset property="netbeans.home"/> 4.1075 - <not> 4.1076 - <isset property="browser.context"/> 4.1077 - </not> 4.1078 - </and> 4.1079 - </condition> 4.1080 - <condition property="do.display.browser.nb"> 4.1081 - <and> 4.1082 - <isset property="netbeans.home"/> 4.1083 - <isset property="browser.context"/> 4.1084 - </and> 4.1085 - </condition> 4.1086 - <condition property="do.display.browser.cl"> 4.1087 - <isset property="deploy.ant.enabled"/> 4.1088 - </condition> 4.1089 - </target> 4.1090 - <target if="do.display.browser.nb.old" name="-display-browser-nb-old"> 4.1091 - <nbbrowse url="${client.url}"/> 4.1092 - </target> 4.1093 - <target if="do.display.browser.nb" name="-display-browser-nb"> 4.1094 - <nbbrowse context="${browser.context}" url="${client.url}" urlPath="${client.urlPart}"/> 4.1095 - </target> 4.1096 - <target if="do.display.browser.cl" name="-get-browser" unless="browser"> 4.1097 - <condition property="browser" value="rundll32"> 4.1098 - <os family="windows"/> 4.1099 - </condition> 4.1100 - <condition else="" property="browser.args" value="url.dll,FileProtocolHandler"> 4.1101 - <os family="windows"/> 4.1102 - </condition> 4.1103 - <condition property="browser" value="/usr/bin/open"> 4.1104 - <os family="mac"/> 4.1105 - </condition> 4.1106 - <property environment="env"/> 4.1107 - <condition property="browser" value="${env.BROWSER}"> 4.1108 - <isset property="env.BROWSER"/> 4.1109 - </condition> 4.1110 - <condition property="browser" value="/usr/bin/firefox"> 4.1111 - <available file="/usr/bin/firefox"/> 4.1112 - </condition> 4.1113 - <condition property="browser" value="/usr/local/firefox/firefox"> 4.1114 - <available file="/usr/local/firefox/firefox"/> 4.1115 - </condition> 4.1116 - <condition property="browser" value="/usr/bin/mozilla"> 4.1117 - <available file="/usr/bin/mozilla"/> 4.1118 - </condition> 4.1119 - <condition property="browser" value="/usr/local/mozilla/mozilla"> 4.1120 - <available file="/usr/local/mozilla/mozilla"/> 4.1121 - </condition> 4.1122 - <condition property="browser" value="/usr/sfw/lib/firefox/firefox"> 4.1123 - <available file="/usr/sfw/lib/firefox/firefox"/> 4.1124 - </condition> 4.1125 - <condition property="browser" value="/opt/csw/bin/firefox"> 4.1126 - <available file="/opt/csw/bin/firefox"/> 4.1127 - </condition> 4.1128 - <condition property="browser" value="/usr/sfw/lib/mozilla/mozilla"> 4.1129 - <available file="/usr/sfw/lib/mozilla/mozilla"/> 4.1130 - </condition> 4.1131 - <condition property="browser" value="/opt/csw/bin/mozilla"> 4.1132 - <available file="/opt/csw/bin/mozilla"/> 4.1133 - </condition> 4.1134 - </target> 4.1135 - <target depends="-get-browser" if="do.display.browser.cl" name="-display-browser-cl"> 4.1136 - <fail unless="browser"> 4.1137 - Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. 4.1138 - </fail> 4.1139 - <property name="browse.url" value="${deploy.ant.client.url}${client.urlPart}"/> 4.1140 - <echo>Launching ${browse.url}</echo> 4.1141 - <exec executable="${browser}" spawn="true"> 4.1142 - <arg line="${browser.args} ${browse.url}"/> 4.1143 - </exec> 4.1144 - </target> 4.1145 - <target depends="init,-init-cos,compile-single" name="run-main"> 4.1146 - <fail unless="run.class">Must select one file in the IDE or set run.class</fail> 4.1147 - <webproject1:java classname="${run.class}"/> 4.1148 - </target> 4.1149 - <target depends="init,compile-test-single,-pre-test-run-single" name="run-test-with-main"> 4.1150 - <fail unless="run.class">Must select one file in the IDE or set run.class</fail> 4.1151 - <webproject1:java classname="${run.class}" classpath="${run.test.classpath}"/> 4.1152 - </target> 4.1153 - <target depends="init" if="netbeans.home" name="-do-update-breakpoints"> 4.1154 - <webproject1:nbjpdaappreloaded/> 4.1155 - </target> 4.1156 - <!-- 4.1157 - DEBUGGING SECTION 4.1158 - --> 4.1159 - <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"> 4.1160 - <nbstartserver debugmode="true"/> 4.1161 - <antcall target="connect-debugger"/> 4.1162 - <nbdeploy clientUrlPart="${client.urlPart}" debugmode="true" forceRedeploy="true"/> 4.1163 - <antcall target="debug-display-browser-old"/> 4.1164 - <antcall target="debug-display-browser"/> 4.1165 - <antcall target="connect-client-debugger"/> 4.1166 - </target> 4.1167 - <target if="do.debug.server" name="connect-debugger" unless="is.debugged"> 4.1168 - <condition property="listeningcp" value="sourcepath"> 4.1169 - <istrue value="${j2ee.compile.on.save}"/> 4.1170 - </condition> 4.1171 - <nbjpdaconnect address="${jpda.address}" host="${jpda.host}" listeningcp="${listeningcp}" name="${name}" transport="${jpda.transport}"> 4.1172 - <classpath> 4.1173 - <path path="${debug.classpath}:${j2ee.platform.classpath}"/> 4.1174 - </classpath> 4.1175 - <sourcepath> 4.1176 - <path path="${web.docbase.dir}"/> 4.1177 - </sourcepath> 4.1178 - </nbjpdaconnect> 4.1179 - </target> 4.1180 - <target if="do.display.browser.debug.old" name="debug-display-browser-old"> 4.1181 - <nbbrowse url="${client.url}"/> 4.1182 - </target> 4.1183 - <target if="do.display.browser.debug" name="debug-display-browser"> 4.1184 - <nbbrowse context="${browser.context}" url="${client.url}" urlPath="${client.urlPart}"/> 4.1185 - </target> 4.1186 - <target if="do.debug.client" name="connect-client-debugger"> 4.1187 - <webproject1:nbjsdebugstart webUrl="${client.url}"/> 4.1188 - </target> 4.1189 - <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test"> 4.1190 - <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> 4.1191 - <webproject1:debug classname="${debug.class}" classpath="${debug.test.classpath}"/> 4.1192 - </target> 4.1193 - <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/> 4.1194 - <target depends="init,compile,compile-jsps,-do-compile-single-jsp,debug" if="netbeans.home" name="debug-single"/> 4.1195 - <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test"> 4.1196 - <webproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/> 4.1197 - </target> 4.1198 - <target depends="init" if="netbeans.home" name="-debug-start-debugger"> 4.1199 - <webproject1:nbjpdastart name="${debug.class}"/> 4.1200 - </target> 4.1201 - <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single"> 4.1202 - <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> 4.1203 - <webproject1:debug classname="${debug.class}"/> 4.1204 - </target> 4.1205 - <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single-main"/> 4.1206 - <target depends="init" name="-pre-debug-fix"> 4.1207 - <fail unless="fix.includes">Must set fix.includes</fail> 4.1208 - <property name="javac.includes" value="${fix.includes}.java"/> 4.1209 - </target> 4.1210 - <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix"> 4.1211 - <webproject1:nbjpdareload/> 4.1212 - </target> 4.1213 - <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/> 4.1214 - <!-- 4.1215 - ================= 4.1216 - PROFILING SECTION 4.1217 - ================= 4.1218 - --> 4.1219 - <!-- 4.1220 - pre NB7.2 profiling section; consider it deprecated 4.1221 - --> 4.1222 - <target description="Profile a J2EE project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72"> 4.1223 - <condition else="start-profiled-server" property="profiler.startserver.target" value="start-profiled-server-extraargs"> 4.1224 - <isset property="profiler.info.jvmargs.extra"/> 4.1225 - </condition> 4.1226 - <antcall target="${profiler.startserver.target}"/> 4.1227 - <antcall target="run"/> 4.1228 - <antcall target="-profile-start-loadgen"/> 4.1229 - </target> 4.1230 - <target if="profiler.info.jvmargs.agent" name="start-profiled-server"> 4.1231 - <nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" javaPlatform="${profiler.info.javaPlatform}" startupTimeout="${profiler.j2ee.serverStartupTimeout}"> 4.1232 - <jvmarg value="${profiler.info.jvmargs.agent}"/> 4.1233 - <jvmarg value="${profiler.j2ee.agentID}"/> 4.1234 - </nbstartprofiledserver> 4.1235 - </target> 4.1236 - <target if="profiler.info.jvmargs.agent" name="start-profiled-server-extraargs"> 4.1237 - <nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" javaPlatform="${profiler.info.javaPlatform}" startupTimeout="${profiler.j2ee.serverStartupTimeout}"> 4.1238 - <jvmarg value="${profiler.info.jvmargs.extra}"/> 4.1239 - <jvmarg value="${profiler.info.jvmargs.agent}"/> 4.1240 - <jvmarg value="${profiler.j2ee.agentID}"/> 4.1241 - </nbstartprofiledserver> 4.1242 - </target> 4.1243 - <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72"> 4.1244 - <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> 4.1245 - <nbprofiledirect> 4.1246 - <classpath> 4.1247 - <path path="${run.test.classpath}"/> 4.1248 - <path path="${j2ee.platform.classpath}"/> 4.1249 - </classpath> 4.1250 - </nbprofiledirect> 4.1251 - <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true"> 4.1252 - <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> 4.1253 - <jvmarg value="${profiler.info.jvmargs.agent}"/> 4.1254 - <jvmarg line="${profiler.info.jvmargs}"/> 4.1255 - <test name="${profile.class}"/> 4.1256 - <classpath> 4.1257 - <path path="${run.test.classpath}"/> 4.1258 - <path path="${j2ee.platform.classpath}"/> 4.1259 - </classpath> 4.1260 - <syspropertyset> 4.1261 - <propertyref prefix="test-sys-prop."/> 4.1262 - <mapper from="test-sys-prop.*" to="*" type="glob"/> 4.1263 - </syspropertyset> 4.1264 - <formatter type="brief" usefile="false"/> 4.1265 - <formatter type="xml"/> 4.1266 - </junit> 4.1267 - </target> 4.1268 - <target if="netbeans.home" name="-profile-check"> 4.1269 - <condition property="profiler.configured"> 4.1270 - <or> 4.1271 - <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/> 4.1272 - <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/> 4.1273 - </or> 4.1274 - </condition> 4.1275 - </target> 4.1276 - <target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest" name="-do-profile"> 4.1277 - <startprofiler/> 4.1278 - <nbstartserver profilemode="true"/> 4.1279 - <nbdeploy clientUrlPart="${client.urlPart}" forceRedeploy="true" profilemode="true"/> 4.1280 - <antcall target="debug-display-browser-old"/> 4.1281 - <antcall target="debug-display-browser"/> 4.1282 - <antcall target="-profile-start-loadgen"/> 4.1283 - </target> 4.1284 - <target depends="-profile-check,-profile-pre72" description="Profile a J2EE project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent"> 4.1285 - <antcall target="-do-profile"/> 4.1286 - </target> 4.1287 - <target depends="-profile-test-single-pre72" name="profile-test-single"/> 4.1288 - <target depends="-profile-check" if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs.agent"> 4.1289 - <startprofiler/> 4.1290 - <antcall target="test-single"/> 4.1291 - </target> 4.1292 - <target if="profiler.loadgen.path" name="-profile-start-loadgen"> 4.1293 - <loadgenstart path="${profiler.loadgen.path}"/> 4.1294 - </target> 4.1295 - <!-- 4.1296 - JAVADOC SECTION 4.1297 - --> 4.1298 - <target depends="init" if="have.sources" name="javadoc-build"> 4.1299 - <mkdir dir="${dist.javadoc.dir}"/> 4.1300 - <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}"> 4.1301 - <classpath> 4.1302 - <path path="${javac.classpath}:${j2ee.platform.classpath}"/> 4.1303 - </classpath> 4.1304 - <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> 4.1305 - <filename name="**/*.java"/> 4.1306 - </fileset> 4.1307 - <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> 4.1308 - <include name="**/*.java"/> 4.1309 - </fileset> 4.1310 - </javadoc> 4.1311 - <copy todir="${dist.javadoc.dir}"> 4.1312 - <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> 4.1313 - <filename name="**/doc-files/**"/> 4.1314 - </fileset> 4.1315 - <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> 4.1316 - <include name="**/doc-files/**"/> 4.1317 - </fileset> 4.1318 - </copy> 4.1319 - </target> 4.1320 - <target depends="init,javadoc-build" if="netbeans.home" name="javadoc-browse" unless="no.javadoc.preview"> 4.1321 - <nbbrowse file="${dist.javadoc.dir}/index.html"/> 4.1322 - </target> 4.1323 - <target depends="init,javadoc-build,javadoc-browse" description="Build Javadoc." name="javadoc"/> 4.1324 - <!-- 4.1325 - 4.1326 - TEST COMPILATION SECTION 4.1327 - --> 4.1328 - <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> 4.1329 - <mkdir dir="${build.test.classes.dir}"/> 4.1330 - <property name="j2ee.platform.embeddableejb.classpath" value=""/> 4.1331 - </target> 4.1332 - <target name="-pre-compile-test"> 4.1333 - <!-- Empty placeholder for easier customization. --> 4.1334 - <!-- You can override this target in the ../build.xml file. --> 4.1335 - </target> 4.1336 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test" if="have.tests" name="-do-compile-test"> 4.1337 - <webproject2:javac classpath="${javac.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> 4.1338 - <copy todir="${build.test.classes.dir}"> 4.1339 - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> 4.1340 - </copy> 4.1341 - </target> 4.1342 - <target name="-post-compile-test"> 4.1343 - <!-- Empty placeholder for easier customization. --> 4.1344 - <!-- You can override this target in the ../build.xml file. --> 4.1345 - </target> 4.1346 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/> 4.1347 - <target name="-pre-compile-test-single"> 4.1348 - <!-- Empty placeholder for easier customization. --> 4.1349 - <!-- You can override this target in the ../build.xml file. --> 4.1350 - </target> 4.1351 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> 4.1352 - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> 4.1353 - <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}"/> 4.1354 - <copy todir="${build.test.classes.dir}"> 4.1355 - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> 4.1356 - </copy> 4.1357 - </target> 4.1358 - <target name="-post-compile-test-single"> 4.1359 - <!-- Empty placeholder for easier customization. --> 4.1360 - <!-- You can override this target in the ../build.xml file. --> 4.1361 - </target> 4.1362 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> 4.1363 - <!-- 4.1364 - 4.1365 - TEST EXECUTION SECTION 4.1366 - --> 4.1367 - <target depends="init" if="have.tests" name="-pre-test-run"> 4.1368 - <mkdir dir="${build.test.results.dir}"/> 4.1369 - </target> 4.1370 - <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> 4.1371 - <webproject2:test includes="${includes}" testincludes="**/*Test.java"/> 4.1372 - </target> 4.1373 - <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> 4.1374 - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> 4.1375 - </target> 4.1376 - <target depends="init" if="have.tests" name="test-report"/> 4.1377 - <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/> 4.1378 - <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/> 4.1379 - <target depends="init" if="have.tests" name="-pre-test-run-single"> 4.1380 - <mkdir dir="${build.test.results.dir}"/> 4.1381 - </target> 4.1382 - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> 4.1383 - <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> 4.1384 - <webproject2:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/> 4.1385 - </target> 4.1386 - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> 4.1387 - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> 4.1388 - </target> 4.1389 - <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"/> 4.1390 - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method"> 4.1391 - <fail unless="test.class">Must select some files in the IDE or set test.class</fail> 4.1392 - <fail unless="test.method">Must select some method in the IDE or set test.method</fail> 4.1393 - <webproject2:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/> 4.1394 - </target> 4.1395 - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method"> 4.1396 - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> 4.1397 - </target> 4.1398 - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/> 4.1399 - <!-- 4.1400 - 4.1401 - TEST DEBUGGING SECTION 4.1402 - --> 4.1403 - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test"> 4.1404 - <fail unless="test.class">Must select one file in the IDE or set test.class</fail> 4.1405 - <webproject2:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/> 4.1406 - </target> 4.1407 - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method"> 4.1408 - <fail unless="test.class">Must select one file in the IDE or set test.class</fail> 4.1409 - <fail unless="test.method">Must select some method in the IDE or set test.method</fail> 4.1410 - <webproject2:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/> 4.1411 - </target> 4.1412 - <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> 4.1413 - <webproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> 4.1414 - </target> 4.1415 - <target depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> 4.1416 - <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/> 4.1417 - <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> 4.1418 - <webproject1:nbjpdareload dir="${build.test.classes.dir}"/> 4.1419 - </target> 4.1420 - <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/> 4.1421 - <!-- 4.1422 - 4.1423 - CLEANUP SECTION 4.1424 - --> 4.1425 - <target depends="init" name="deps-clean" unless="no.deps"/> 4.1426 - <target depends="init" name="do-clean"> 4.1427 - <condition property="build.dir.to.clean" value="${build.web.dir}"> 4.1428 - <isset property="dist.ear.dir"/> 4.1429 - </condition> 4.1430 - <property name="build.dir.to.clean" value="${build.web.dir}"/> 4.1431 - <delete includeEmptyDirs="true" quiet="true"> 4.1432 - <fileset dir="${build.dir.to.clean}/WEB-INF/lib"/> 4.1433 - </delete> 4.1434 - <delete dir="${build.dir}"/> 4.1435 - <available file="${build.dir.to.clean}/WEB-INF/lib" property="status.clean-failed" type="dir"/> 4.1436 - <delete dir="${dist.dir}"/> 4.1437 - </target> 4.1438 - <target depends="do-clean" if="status.clean-failed" name="check-clean"> 4.1439 - <echo message="Warning: unable to delete some files in ${build.web.dir}/WEB-INF/lib - they are probably locked by the J2EE server. "/> 4.1440 - <echo level="info" message="To delete all files undeploy the module from Server Registry in Runtime tab and then use Clean again."/> 4.1441 - </target> 4.1442 - <target depends="init" if="netbeans.home" name="undeploy-clean"> 4.1443 - <nbundeploy failOnError="false" startServer="false"/> 4.1444 - </target> 4.1445 - <target name="-post-clean"> 4.1446 - <!-- Empty placeholder for easier customization. --> 4.1447 - <!-- You can override this target in the ../build.xml file. --> 4.1448 - </target> 4.1449 - <target depends="init,undeploy-clean,deps-clean,do-clean,check-clean,-post-clean" description="Clean build products." name="clean"/> 4.1450 - <target depends="clean" description="Clean build products." name="clean-ear"/> 4.1451 -</project>
5.1 --- a/nbproject/genfiles.properties Sun Apr 08 16:51:15 2018 +0200 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,8 +0,0 @@ 5.4 -build.xml.data.CRC32=40807f5e 5.5 -build.xml.script.CRC32=1f023e98 5.6 -build.xml.stylesheet.CRC32=651128d4@1.77.1.1 5.7 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5.8 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 5.9 -nbproject/build-impl.xml.data.CRC32=40807f5e 5.10 -nbproject/build-impl.xml.script.CRC32=0c71c5d8 5.11 -nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.77.1.1
6.1 --- a/nbproject/project.properties Sun Apr 08 16:51:15 2018 +0200 6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 6.3 @@ -1,87 +0,0 @@ 6.4 -annotation.processing.enabled=true 6.5 -annotation.processing.enabled.in.editor=true 6.6 -annotation.processing.processors.list= 6.7 -annotation.processing.run.all.processors=true 6.8 -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 6.9 -build.classes.dir=${build.web.dir}/WEB-INF/classes 6.10 -build.classes.excludes=**/*.java,**/*.form 6.11 -build.dir=build 6.12 -build.generated.dir=${build.dir}/generated 6.13 -build.generated.sources.dir=${build.dir}/generated-sources 6.14 -build.test.classes.dir=${build.dir}/test/classes 6.15 -build.test.results.dir=${build.dir}/test/results 6.16 -build.web.dir=${build.dir}/web 6.17 -build.web.excludes=${build.classes.excludes} 6.18 -client.urlPart= 6.19 -compile.jsps=false 6.20 -conf.dir=${source.root}/conf 6.21 -debug.classpath=${build.classes.dir}:${javac.classpath} 6.22 -debug.test.classpath=\ 6.23 - ${run.test.classpath} 6.24 -display.browser=true 6.25 -# Files to be excluded from distribution war 6.26 -dist.archive.excludes= 6.27 -dist.dir=dist 6.28 -dist.ear.war=${dist.dir}/${war.ear.name} 6.29 -dist.javadoc.dir=${dist.dir}/javadoc 6.30 -dist.war=${dist.dir}/${war.name} 6.31 -endorsed.classpath=\ 6.32 - ${libs.javaee-endorsed-api-7.0.classpath} 6.33 -excludes= 6.34 -includes=** 6.35 -j2ee.compile.on.save=true 6.36 -j2ee.copy.static.files.on.save=true 6.37 -j2ee.deploy.on.save=true 6.38 -j2ee.platform=1.7-web 6.39 -j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-storeconfig.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.6.3.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jaspic-api.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/postgresql-42.1.4.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-jni.jar:${j2ee.server.home}/lib/tomcat-util-scan.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-websocket.jar:${j2ee.server.home}/lib/websocket-api.jar 6.40 -j2ee.server.type=Tomcat 6.41 -jar.compress=false 6.42 -javac.classpath=\ 6.43 - ${libs.jstl.classpath}:\ 6.44 - ${libs.SLF4J-LOG4J2.classpath}:\ 6.45 - ${libs.LOG4J2-WEB.classpath} 6.46 -# Space-separated list of extra javac options 6.47 -javac.compilerargs= 6.48 -javac.debug=true 6.49 -javac.deprecation=false 6.50 -javac.processorpath=\ 6.51 - ${javac.classpath} 6.52 -javac.source=1.8 6.53 -javac.target=1.8 6.54 -javac.test.classpath=\ 6.55 - ${javac.classpath}:\ 6.56 - ${build.classes.dir} 6.57 -javac.test.processorpath=\ 6.58 - ${javac.test.classpath} 6.59 -javadoc.additionalparam= 6.60 -javadoc.author=false 6.61 -javadoc.encoding=${source.encoding} 6.62 -javadoc.noindex=false 6.63 -javadoc.nonavbar=false 6.64 -javadoc.notree=false 6.65 -javadoc.preview=true 6.66 -javadoc.private=false 6.67 -javadoc.splitindex=true 6.68 -javadoc.use=true 6.69 -javadoc.version=false 6.70 -javadoc.windowtitle= 6.71 -lib.dir=${web.docbase.dir}/WEB-INF/lib 6.72 -persistence.xml.dir=${conf.dir} 6.73 -platform.active=default_platform 6.74 -project.license=default 6.75 -resource.dir=setup 6.76 -run.test.classpath=\ 6.77 - ${javac.test.classpath}:\ 6.78 - ${build.test.classes.dir} 6.79 -# Space-separated list of JVM arguments used when running a class with a main method or a unit test 6.80 -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): 6.81 -runmain.jvmargs= 6.82 -source.encoding=UTF-8 6.83 -source.root=src 6.84 -src.dir=${source.root}/java 6.85 -test.src.dir=test 6.86 -war.content.additional= 6.87 -war.ear.name=${war.name} 6.88 -war.name=LightPIT.war 6.89 -web.docbase.dir=web 6.90 -webinf.dir=web/WEB-INF
7.1 --- a/nbproject/project.xml Sun Apr 08 16:51:15 2018 +0200 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,31 +0,0 @@ 7.4 -<?xml version="1.0" encoding="UTF-8"?> 7.5 -<project xmlns="http://www.netbeans.org/ns/project/1"> 7.6 - <type>org.netbeans.modules.web.project</type> 7.7 - <configuration> 7.8 - <data xmlns="http://www.netbeans.org/ns/web-project/3"> 7.9 - <name>LightPIT</name> 7.10 - <minimum-ant-version>1.6.5</minimum-ant-version> 7.11 - <web-module-libraries> 7.12 - <library dirs="200"> 7.13 - <file>${libs.jstl.classpath}</file> 7.14 - <path-in-war>WEB-INF/lib</path-in-war> 7.15 - </library> 7.16 - <library dirs="200"> 7.17 - <file>${libs.SLF4J-LOG4J2.classpath}</file> 7.18 - <path-in-war>WEB-INF/lib</path-in-war> 7.19 - </library> 7.20 - <library dirs="200"> 7.21 - <file>${libs.LOG4J2-WEB.classpath}</file> 7.22 - <path-in-war>WEB-INF/lib</path-in-war> 7.23 - </library> 7.24 - </web-module-libraries> 7.25 - <web-module-additional-libraries/> 7.26 - <source-roots> 7.27 - <root id="src.dir"/> 7.28 - </source-roots> 7.29 - <test-roots> 7.30 - <root id="test.src.dir"/> 7.31 - </test-roots> 7.32 - </data> 7.33 - </configuration> 7.34 -</project>
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/pom.xml Sat May 09 14:26:31 2020 +0200 8.3 @@ -0,0 +1,74 @@ 8.4 +<?xml version="1.0" encoding="UTF-8"?> 8.5 +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" 8.6 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 8.7 + <modelVersion>4.0.0</modelVersion> 8.8 + <groupId>de.uapcore</groupId> 8.9 + <artifactId>lightpit</artifactId> 8.10 + <version>0.1-SNAPSHOT</version> 8.11 + <packaging>war</packaging> 8.12 + <properties> 8.13 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 8.14 + <maven.compiler.source>11</maven.compiler.source> 8.15 + <maven.compiler.target>11</maven.compiler.target> 8.16 + <version.maven.compiler>3.8.1</version.maven.compiler> 8.17 + <version.maven.war>3.2.0</version.maven.war> 8.18 + <version.slf4j>1.7.30</version.slf4j> 8.19 + <version.log4j>2.13.1</version.log4j> 8.20 + </properties> 8.21 + <dependencies> 8.22 + <dependency> 8.23 + <groupId>org.slf4j</groupId> 8.24 + <artifactId>slf4j-api</artifactId> 8.25 + <version>${version.slf4j}</version> 8.26 + </dependency> 8.27 + <dependency> 8.28 + <groupId>org.apache.logging.log4j</groupId> 8.29 + <artifactId>log4j-core</artifactId> 8.30 + <version>${version.log4j}</version> 8.31 + </dependency> 8.32 + <dependency> 8.33 + <groupId>org.apache.logging.log4j</groupId> 8.34 + <artifactId>log4j-slf4j-impl</artifactId> 8.35 + <version>${version.log4j}</version> 8.36 + </dependency> 8.37 + <dependency> 8.38 + <groupId>javax.servlet</groupId> 8.39 + <artifactId>jstl</artifactId> 8.40 + <version>1.2</version> 8.41 + </dependency> 8.42 + <dependency> 8.43 + <groupId>javax.servlet</groupId> 8.44 + <artifactId>javax.servlet-api</artifactId> 8.45 + <version>3.1.0</version> 8.46 + <scope>provided</scope> 8.47 + </dependency> 8.48 + </dependencies> 8.49 + <build> 8.50 + <finalName>${project.artifactId}</finalName> 8.51 + <plugins> 8.52 + <plugin> 8.53 + <groupId>org.apache.maven.plugins</groupId> 8.54 + <artifactId>maven-compiler-plugin</artifactId> 8.55 + <version>${version.maven.compiler}</version> 8.56 + </plugin> 8.57 + <plugin> 8.58 + <groupId>org.apache.maven.plugins</groupId> 8.59 + <artifactId>maven-war-plugin</artifactId> 8.60 + <version>${version.maven.war}</version> 8.61 + <configuration> 8.62 + <archive> 8.63 + <manifest> 8.64 + <addClasspath>true</addClasspath> 8.65 + <classpathPrefix>lib/</classpathPrefix> 8.66 + </manifest> 8.67 + </archive> 8.68 + <webResources> 8.69 + <resource> 8.70 + <directory>${project.basedir}/src/main/resources</directory> 8.71 + </resource> 8.72 + </webResources> 8.73 + </configuration> 8.74 + </plugin> 8.75 + </plugins> 8.76 + </build> 8.77 +</project>
9.1 --- a/src/conf/MANIFEST.MF Sun Apr 08 16:51:15 2018 +0200 9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 9.3 @@ -1,2 +0,0 @@ 9.4 -Manifest-Version: 1.0 9.5 -
10.1 --- a/src/java/de/uapcore/lightpit/AbstractLightPITServlet.java Sun Apr 08 16:51:15 2018 +0200 10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 10.3 @@ -1,296 +0,0 @@ 10.4 -/* 10.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 10.6 - * 10.7 - * Copyright 2018 Mike Becker. All rights reserved. 10.8 - * 10.9 - * Redistribution and use in source and binary forms, with or without 10.10 - * modification, are permitted provided that the following conditions are met: 10.11 - * 10.12 - * 1. Redistributions of source code must retain the above copyright 10.13 - * notice, this list of conditions and the following disclaimer. 10.14 - * 10.15 - * 2. Redistributions in binary form must reproduce the above copyright 10.16 - * notice, this list of conditions and the following disclaimer in the 10.17 - * documentation and/or other materials provided with the distribution. 10.18 - * 10.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 10.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 10.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 10.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 10.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 10.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 10.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 10.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 10.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 10.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 10.29 - * POSSIBILITY OF SUCH DAMAGE. 10.30 - * 10.31 - */ 10.32 -package de.uapcore.lightpit; 10.33 - 10.34 -import java.io.IOException; 10.35 -import java.lang.reflect.Method; 10.36 -import java.lang.reflect.Modifier; 10.37 -import java.util.Arrays; 10.38 -import java.util.HashMap; 10.39 -import java.util.List; 10.40 -import java.util.Locale; 10.41 -import java.util.Map; 10.42 -import java.util.Optional; 10.43 -import javax.servlet.ServletException; 10.44 -import javax.servlet.http.HttpServlet; 10.45 -import javax.servlet.http.HttpServletRequest; 10.46 -import javax.servlet.http.HttpServletResponse; 10.47 -import javax.servlet.http.HttpSession; 10.48 -import org.slf4j.Logger; 10.49 -import org.slf4j.LoggerFactory; 10.50 - 10.51 -/** 10.52 - * A special implementation of a HTTPServlet which is focused on implementing 10.53 - * the necessary functionality for {@link LightPITModule}s. 10.54 - */ 10.55 -public abstract class AbstractLightPITServlet extends HttpServlet { 10.56 - 10.57 - private static final Logger LOG = LoggerFactory.getLogger(AbstractLightPITServlet.class); 10.58 - 10.59 - private static final String HTML_FULL_DISPATCHER = Functions.jspPath("html_full"); 10.60 - 10.61 - /** 10.62 - * Store a reference to the annotation for quicker access. 10.63 - */ 10.64 - private Optional<LightPITModule> moduleInfo = Optional.empty(); 10.65 - 10.66 - /** 10.67 - * The EL proxy is necessary, because the EL resolver cannot handle annotation properties. 10.68 - */ 10.69 - private Optional<LightPITModule.ELProxy> moduleInfoELProxy = Optional.empty(); 10.70 - 10.71 - 10.72 - @FunctionalInterface 10.73 - private static interface HandlerMethod { 10.74 - ResponseType apply(HttpServletRequest t, HttpServletResponse u) throws IOException, ServletException; 10.75 - } 10.76 - 10.77 - /** 10.78 - * Invocation mapping gathered from the {@link RequestMapping} annotations. 10.79 - * 10.80 - * Paths in this map must always start with a leading slash, although 10.81 - * the specification in the annotation must not start with a leading slash. 10.82 - * 10.83 - * The reason for this is the different handling of empty paths in 10.84 - * {@link HttpServletRequest#getPathInfo()}. 10.85 - */ 10.86 - private final Map<HttpMethod, Map<String, HandlerMethod>> mappings = new HashMap<>(); 10.87 - 10.88 - /** 10.89 - * Gives implementing modules access to the {@link ModuleManager}. 10.90 - * @return the module manager 10.91 - */ 10.92 - protected final ModuleManager getModuleManager() { 10.93 - return (ModuleManager) getServletContext().getAttribute(ModuleManager.SC_ATTR_NAME); 10.94 - } 10.95 - 10.96 - /** 10.97 - * Gives implementing modules access to the {@link DatabaseFacade}. 10.98 - * @return the database facade 10.99 - */ 10.100 - protected final DatabaseFacade getDatabaseFacade() { 10.101 - return (DatabaseFacade) getServletContext().getAttribute(DatabaseFacade.SC_ATTR_NAME); 10.102 - } 10.103 - 10.104 - private ResponseType invokeMapping(Method method, HttpServletRequest req, HttpServletResponse resp) 10.105 - throws IOException, ServletException { 10.106 - try { 10.107 - LOG.trace("invoke {}#{}", method.getDeclaringClass().getName(), method.getName()); 10.108 - return (ResponseType) method.invoke(this, req, resp); 10.109 - } catch (ReflectiveOperationException | ClassCastException ex) { 10.110 - LOG.error(String.format("invocation of method %s failed", method.getName()), ex); 10.111 - resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 10.112 - return ResponseType.NONE; 10.113 - } 10.114 - } 10.115 - 10.116 - @Override 10.117 - public void init() throws ServletException { 10.118 - moduleInfo = Optional.ofNullable(this.getClass().getAnnotation(LightPITModule.class)); 10.119 - moduleInfoELProxy = moduleInfo.map(LightPITModule.ELProxy::convert); 10.120 - 10.121 - if (moduleInfo.isPresent()) { 10.122 - scanForRequestMappings(); 10.123 - } 10.124 - 10.125 - LOG.trace("{} initialized", getServletName()); 10.126 - } 10.127 - 10.128 - private void scanForRequestMappings() { 10.129 - try { 10.130 - Method[] methods = getClass().getDeclaredMethods(); 10.131 - for (Method method : methods) { 10.132 - Optional<RequestMapping> mapping = Optional.ofNullable(method.getAnnotation(RequestMapping.class)); 10.133 - if (mapping.isPresent()) { 10.134 - if (!Modifier.isPublic(method.getModifiers())) { 10.135 - LOG.warn("{} is annotated with {} but is not public", 10.136 - method.getName(), RequestMapping.class.getSimpleName() 10.137 - ); 10.138 - continue; 10.139 - } 10.140 - if (Modifier.isAbstract(method.getModifiers())) { 10.141 - LOG.warn("{} is annotated with {} but is abstract", 10.142 - method.getName(), RequestMapping.class.getSimpleName() 10.143 - ); 10.144 - continue; 10.145 - } 10.146 - if (!ResponseType.class.isAssignableFrom(method.getReturnType())) { 10.147 - LOG.warn("{} is annotated with {} but has the wrong return type - 'ResponseType' required", 10.148 - method.getName(), RequestMapping.class.getSimpleName() 10.149 - ); 10.150 - continue; 10.151 - } 10.152 - 10.153 - Class<?>[] params = method.getParameterTypes(); 10.154 - if (params.length == 2 10.155 - && HttpServletRequest.class.isAssignableFrom(params[0]) 10.156 - && HttpServletResponse.class.isAssignableFrom(params[1])) { 10.157 - 10.158 - final String requestPath = "/"+mapping.get().requestPath(); 10.159 - 10.160 - if (mappings.computeIfAbsent(mapping.get().method(), k -> new HashMap<>()). 10.161 - putIfAbsent(requestPath, 10.162 - (req, resp) -> invokeMapping(method, req, resp)) != null) { 10.163 - LOG.warn("{} {} has multiple mappings", 10.164 - mapping.get().method(), 10.165 - mapping.get().requestPath() 10.166 - ); 10.167 - } 10.168 - 10.169 - LOG.debug("{} {} maps to {}::{}", 10.170 - mapping.get().method(), 10.171 - requestPath, 10.172 - getClass().getSimpleName(), 10.173 - method.getName() 10.174 - ); 10.175 - } else { 10.176 - LOG.warn("{} is annotated with {} but has the wrong parameters - (HttpServletRequest,HttpServletResponse) required", 10.177 - method.getName(), RequestMapping.class.getSimpleName() 10.178 - ); 10.179 - } 10.180 - } 10.181 - } 10.182 - } catch (SecurityException ex) { 10.183 - LOG.error("Scan for request mappings on declared methods failed.", ex); 10.184 - } 10.185 - } 10.186 - 10.187 - @Override 10.188 - public void destroy() { 10.189 - mappings.clear(); 10.190 - LOG.trace("{} destroyed", getServletName()); 10.191 - } 10.192 - 10.193 - /** 10.194 - * Sets the name of the dynamic fragment. 10.195 - * 10.196 - * It is sufficient to specify the name without any extension. The extension 10.197 - * is added automatically if not specified. 10.198 - * 10.199 - * The fragment must be located in the dynamic fragments folder. 10.200 - * 10.201 - * @param req the servlet request object 10.202 - * @param fragmentName the name of the fragment 10.203 - * @see Constants#DYN_FRAGMENT_PATH_PREFIX 10.204 - */ 10.205 - public void setDynamicFragment(HttpServletRequest req, String fragmentName) { 10.206 - req.setAttribute(Constants.REQ_ATTR_FRAGMENT, Functions.dynFragmentPath(fragmentName)); 10.207 - } 10.208 - 10.209 - /** 10.210 - * Specifies the name of an additional stylesheet used by the module. 10.211 - * 10.212 - * Setting an additional stylesheet is optional, but quite common for HTML 10.213 - * output. 10.214 - * 10.215 - * It is sufficient to specify the name without any extension. The extension 10.216 - * is added automatically if not specified. 10.217 - * 10.218 - * @param req the servlet request object 10.219 - * @param stylesheet the name of the stylesheet 10.220 - */ 10.221 - public void setStylesheet(HttpServletRequest req, String stylesheet) { 10.222 - req.setAttribute(Constants.REQ_ATTR_STYLESHEET, Functions.enforceExt(stylesheet, ".css")); 10.223 - } 10.224 - 10.225 - private void forwardToFullView(HttpServletRequest req, HttpServletResponse resp) 10.226 - throws IOException, ServletException { 10.227 - 10.228 - req.setAttribute(Constants.REQ_ATTR_MENU, getModuleManager().getMainMenu(getDatabaseFacade())); 10.229 - req.getRequestDispatcher(HTML_FULL_DISPATCHER).forward(req, resp); 10.230 - } 10.231 - 10.232 - private Optional<HandlerMethod> findMapping(HttpMethod method, HttpServletRequest req) { 10.233 - return Optional.ofNullable(mappings.get(method)).map( 10.234 - (rm) -> rm.get(Optional.ofNullable(req.getPathInfo()).orElse("/")) 10.235 - ); 10.236 - } 10.237 - 10.238 - private void forwardAsSepcified(ResponseType type, HttpServletRequest req, HttpServletResponse resp) 10.239 - throws ServletException, IOException { 10.240 - switch (type) { 10.241 - case NONE: return; 10.242 - case HTML_FULL: 10.243 - forwardToFullView(req, resp); 10.244 - return; 10.245 - // TODO: implement remaining response types 10.246 - default: 10.247 - // this code should be unreachable 10.248 - LOG.error("ResponseType switch is not exhaustive - this is a bug!"); 10.249 - throw new UnsupportedOperationException(); 10.250 - } 10.251 - } 10.252 - 10.253 - private void doProcess(HttpMethod method, HttpServletRequest req, HttpServletResponse resp) 10.254 - throws ServletException, IOException { 10.255 - 10.256 - // Synchronize module information with database 10.257 - getModuleManager().syncWithDatabase(getDatabaseFacade()); 10.258 - 10.259 - // choose the requested language as session language (if available) or fall back to english, otherwise 10.260 - HttpSession session = req.getSession(); 10.261 - if (session.getAttribute(Constants.SESSION_ATTR_LANGUAGE) == null) { 10.262 - Optional<List<String>> availableLanguages = Functions.availableLanguages(getServletContext()).map(Arrays::asList); 10.263 - Optional<Locale> reqLocale = Optional.of(req.getLocale()); 10.264 - Locale sessionLocale = reqLocale.filter((rl) -> availableLanguages.map((al) -> al.contains(rl.getLanguage())).orElse(false)).orElse(Locale.ENGLISH); 10.265 - session.setAttribute(Constants.SESSION_ATTR_LANGUAGE, sessionLocale); 10.266 - LOG.debug("Settng language for new session {}: {}", session.getId(), sessionLocale.getDisplayLanguage()); 10.267 - } else { 10.268 - Locale sessionLocale = (Locale) session.getAttribute(Constants.SESSION_ATTR_LANGUAGE); 10.269 - resp.setLocale(sessionLocale); 10.270 - LOG.trace("Continuing session {} with language {}", session.getId(), sessionLocale); 10.271 - } 10.272 - 10.273 - // set some internal request attributes 10.274 - req.setAttribute(Constants.REQ_ATTR_PATH, Functions.fullPath(req)); 10.275 - req.setAttribute(Constants.REQ_ATTR_MODULE_CLASSNAME, this.getClass().getName()); 10.276 - moduleInfoELProxy.ifPresent((proxy) -> req.setAttribute(Constants.REQ_ATTR_MODULE_INFO, proxy)); 10.277 - 10.278 - 10.279 - // call the handler, if available, or send an HTTP 404 error 10.280 - Optional<HandlerMethod> mapping = findMapping(method, req); 10.281 - if (mapping.isPresent()) { 10.282 - forwardAsSepcified(mapping.get().apply(req, resp), req, resp); 10.283 - } else { 10.284 - resp.sendError(HttpServletResponse.SC_NOT_FOUND); 10.285 - } 10.286 - } 10.287 - 10.288 - @Override 10.289 - protected final void doGet(HttpServletRequest req, HttpServletResponse resp) 10.290 - throws ServletException, IOException { 10.291 - doProcess(HttpMethod.GET, req, resp); 10.292 - } 10.293 - 10.294 - @Override 10.295 - protected final void doPost(HttpServletRequest req, HttpServletResponse resp) 10.296 - throws ServletException, IOException { 10.297 - doProcess(HttpMethod.POST, req, resp); 10.298 - } 10.299 -}
11.1 --- a/src/java/de/uapcore/lightpit/Constants.java Sun Apr 08 16:51:15 2018 +0200 11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 11.3 @@ -1,106 +0,0 @@ 11.4 -/* 11.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 11.6 - * 11.7 - * Copyright 2018 Mike Becker. All rights reserved. 11.8 - * 11.9 - * Redistribution and use in source and binary forms, with or without 11.10 - * modification, are permitted provided that the following conditions are met: 11.11 - * 11.12 - * 1. Redistributions of source code must retain the above copyright 11.13 - * notice, this list of conditions and the following disclaimer. 11.14 - * 11.15 - * 2. Redistributions in binary form must reproduce the above copyright 11.16 - * notice, this list of conditions and the following disclaimer in the 11.17 - * documentation and/or other materials provided with the distribution. 11.18 - * 11.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 11.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 11.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 11.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 11.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 11.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 11.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 11.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 11.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 11.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 11.29 - * POSSIBILITY OF SUCH DAMAGE. 11.30 - * 11.31 - */ 11.32 -package de.uapcore.lightpit; 11.33 - 11.34 -import static de.uapcore.lightpit.Functions.fqn; 11.35 - 11.36 -/** 11.37 - * Contains all non-local scope constants used by the this application. 11.38 - * 11.39 - * Constants with (class) local scope are defined in their respective classes. 11.40 - */ 11.41 -public final class Constants { 11.42 - public static final String JSP_PATH_PREFIX = "/WEB-INF/jsp/"; 11.43 - 11.44 - public static final String JSPF_PATH_PREFIX = "/WEB-INF/jspf/"; 11.45 - 11.46 - public static final String DYN_FRAGMENT_PATH_PREFIX = "/WEB-INF/dynamic_fragments/"; 11.47 - 11.48 - 11.49 - /** 11.50 - * Name for the context parameter specifying the available languages. 11.51 - */ 11.52 - public static final String CTX_ATTR_LANGUAGES = "available-languages"; 11.53 - 11.54 - /** 11.55 - * Name for the context parameter optionally specifying the JNDI context; 11.56 - */ 11.57 - public static final String CTX_ATTR_JNDI_CONTEXT = "jndi-context"; 11.58 - 11.59 - /** 11.60 - * Name for the context parameter optionally specifying a database schema. 11.61 - */ 11.62 - public static final String CTX_ATTR_DB_SCHEMA = "db-schema"; 11.63 - 11.64 - /** 11.65 - * Name for the context parameter optionally specifying a database dialect. 11.66 - */ 11.67 - public static final String CTX_ATTR_DB_DIALECT = "db-dialect"; 11.68 - 11.69 - /** 11.70 - * Key for the request attribute containing the class name of the currently dispatching module. 11.71 - */ 11.72 - public static final String REQ_ATTR_MODULE_CLASSNAME = fqn(AbstractLightPITServlet.class, "moduleClassname"); 11.73 - 11.74 - /** 11.75 - * Key for the request attribute containing the {@link LightPITModule} information of the currently dispatching module. 11.76 - */ 11.77 - public static final String REQ_ATTR_MODULE_INFO = fqn(AbstractLightPITServlet.class, "moduleInfo"); 11.78 - 11.79 - /** 11.80 - * Key for the request attribute containing the menu list. 11.81 - */ 11.82 - public static final String REQ_ATTR_MENU = fqn(AbstractLightPITServlet.class, "mainMenu"); 11.83 - 11.84 - /** 11.85 - * Key for the request attribute containing the full path information (servlet path + path info). 11.86 - */ 11.87 - public static final String REQ_ATTR_PATH = fqn(AbstractLightPITServlet.class, "path"); 11.88 - 11.89 - /** 11.90 - * Key for the name of the fragment which should be rendered. 11.91 - */ 11.92 - public static final String REQ_ATTR_FRAGMENT = fqn(AbstractLightPITServlet.class, "fragment"); 11.93 - 11.94 - /** 11.95 - * Key for the name of the additional stylesheet used by a module. 11.96 - */ 11.97 - public static final String REQ_ATTR_STYLESHEET = fqn(AbstractLightPITServlet.class, "extraCss"); 11.98 - 11.99 - 11.100 - /** 11.101 - * Key for the current language selection within the session. 11.102 - */ 11.103 - public static final String SESSION_ATTR_LANGUAGE = fqn(AbstractLightPITServlet.class, "language"); 11.104 - 11.105 - /** 11.106 - * This class is not instantiatable. 11.107 - */ 11.108 - private Constants() {} 11.109 -}
12.1 --- a/src/java/de/uapcore/lightpit/DatabaseFacade.java Sun Apr 08 16:51:15 2018 +0200 12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 12.3 @@ -1,178 +0,0 @@ 12.4 -/* 12.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 12.6 - * 12.7 - * Copyright 2018 Mike Becker. All rights reserved. 12.8 - * 12.9 - * Redistribution and use in source and binary forms, with or without 12.10 - * modification, are permitted provided that the following conditions are met: 12.11 - * 12.12 - * 1. Redistributions of source code must retain the above copyright 12.13 - * notice, this list of conditions and the following disclaimer. 12.14 - * 12.15 - * 2. Redistributions in binary form must reproduce the above copyright 12.16 - * notice, this list of conditions and the following disclaimer in the 12.17 - * documentation and/or other materials provided with the distribution. 12.18 - * 12.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 12.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 12.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 12.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 12.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 12.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 12.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 12.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 12.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 12.29 - * POSSIBILITY OF SUCH DAMAGE. 12.30 - * 12.31 - */ 12.32 -package de.uapcore.lightpit; 12.33 - 12.34 -import java.sql.Connection; 12.35 -import java.sql.DatabaseMetaData; 12.36 -import java.sql.SQLException; 12.37 -import java.util.Optional; 12.38 -import javax.naming.Context; 12.39 -import javax.naming.InitialContext; 12.40 -import javax.naming.NamingException; 12.41 -import javax.servlet.ServletContext; 12.42 -import javax.servlet.ServletContextEvent; 12.43 -import javax.servlet.ServletContextListener; 12.44 -import javax.servlet.annotation.WebListener; 12.45 -import javax.sql.DataSource; 12.46 -import org.slf4j.Logger; 12.47 -import org.slf4j.LoggerFactory; 12.48 - 12.49 -/** 12.50 - * Provides access to different privilege layers within the database. 12.51 - */ 12.52 -@WebListener 12.53 -public final class DatabaseFacade implements ServletContextListener { 12.54 - 12.55 - private static final Logger LOG = LoggerFactory.getLogger(DatabaseFacade.class); 12.56 - 12.57 - /** 12.58 - * Timeout in seconds for the validation test. 12.59 - */ 12.60 - private static final int DB_TEST_TIMEOUT = 10; 12.61 - 12.62 - public static enum Dialect { 12.63 - Postgres; 12.64 - } 12.65 - 12.66 - /** 12.67 - * The database dialect to use. 12.68 - * 12.69 - * May be override by context parameter. 12.70 - * 12.71 - * @see Constants#CTX_ATTR_DB_DIALECT 12.72 - */ 12.73 - private Dialect dialect = Dialect.Postgres; 12.74 - 12.75 - /** 12.76 - * The default schema to test against when validating the connection. 12.77 - * 12.78 - * May be overridden by context parameter. 12.79 - * 12.80 - * @see Constants#CTX_ATTR_DB_SCHEMA 12.81 - */ 12.82 - private static final String DB_DEFAULT_SCHEMA = "lightpit"; 12.83 - 12.84 - /** 12.85 - * The attribute name in the Servlet context under which an instance of this class can be found. 12.86 - */ 12.87 - public static final String SC_ATTR_NAME = DatabaseFacade.class.getName(); 12.88 - private ServletContext sc; 12.89 - 12.90 - private static final String DS_JNDI_NAME = "jdbc/lightpit/app"; 12.91 - private Optional<DataSource> dataSource; 12.92 - 12.93 - /** 12.94 - * Returns the data source. 12.95 - * 12.96 - * The Optional returned should never be empty. However, if something goes 12.97 - * wrong during initialization, the data source might be absent. 12.98 - * Hence, users of this data source are forced to check the existence. 12.99 - * 12.100 - * @return a data source 12.101 - */ 12.102 - public Optional<DataSource> getDataSource() { 12.103 - return dataSource; 12.104 - } 12.105 - 12.106 - public Dialect getSQLDialect() { 12.107 - return dialect; 12.108 - } 12.109 - 12.110 - private static void checkConnection(DataSource ds, String testSchema, String errMsg) { 12.111 - try (Connection conn = ds.getConnection()) { 12.112 - if (!conn.isValid(DB_TEST_TIMEOUT)) { 12.113 - throw new SQLException("Validation check failed."); 12.114 - } 12.115 - if (conn.isReadOnly()) { 12.116 - throw new SQLException("Connection is read-only and thus unusable."); 12.117 - } 12.118 - if (!conn.getSchema().equals(testSchema)) { 12.119 - throw new SQLException(String.format("Connection is not configured to use the schema %s.", testSchema)); 12.120 - } 12.121 - DatabaseMetaData metaData = conn.getMetaData(); 12.122 - LOG.info("Connections as {} to {}/{} ready to go.", metaData.getUserName(), metaData.getURL(), conn.getSchema()); 12.123 - } catch (SQLException ex) { 12.124 - LOG.error(errMsg, ex); 12.125 - } 12.126 - } 12.127 - 12.128 - private static Optional<DataSource> retrieveDataSource(Context ctx) { 12.129 - DataSource ret = null; 12.130 - try { 12.131 - ret = (DataSource)ctx.lookup(DS_JNDI_NAME); 12.132 - LOG.info("Data source retrieved."); 12.133 - } catch (NamingException ex) { 12.134 - LOG.error("Data source {} not available.", DS_JNDI_NAME); 12.135 - LOG.error("Reason for the missing data source: ", ex); 12.136 - } 12.137 - return Optional.ofNullable(ret); 12.138 - } 12.139 - 12.140 - @Override 12.141 - public void contextInitialized(ServletContextEvent sce) { 12.142 - sc = sce.getServletContext(); 12.143 - 12.144 - dataSource = null; 12.145 - 12.146 - final String contextName = Optional 12.147 - .ofNullable(sc.getInitParameter(Constants.CTX_ATTR_JNDI_CONTEXT)) 12.148 - .orElse("java:comp/env"); 12.149 - final String dbSchema = Optional 12.150 - .ofNullable(sc.getInitParameter(Constants.CTX_ATTR_DB_SCHEMA)) 12.151 - .orElse(DB_DEFAULT_SCHEMA); 12.152 - final String dbDialect = sc.getInitParameter(Constants.CTX_ATTR_DB_DIALECT); 12.153 - if (dbDialect != null) { 12.154 - try { 12.155 - dialect = Dialect.valueOf(dbDialect); 12.156 - } catch (IllegalArgumentException ex) { 12.157 - LOG.error("Unknown or unsupported database dialect {}. Defaulting to {}.", dbDialect, dialect); 12.158 - } 12.159 - } 12.160 - 12.161 - try { 12.162 - LOG.debug("Trying to access JNDI context {}...", contextName); 12.163 - Context initialCtx = new InitialContext(); 12.164 - Context ctx = (Context) initialCtx.lookup(contextName); 12.165 - 12.166 - dataSource = retrieveDataSource(ctx); 12.167 - 12.168 - dataSource.ifPresent((ds) -> checkConnection(ds, dbSchema, "Checking database connection failed")); 12.169 - } catch (NamingException | ClassCastException ex) { 12.170 - LOG.error("Cannot access JNDI resources.", ex); 12.171 - } 12.172 - 12.173 - sc.setAttribute(SC_ATTR_NAME, this); 12.174 - LOG.info("Database facade injected into ServletContext."); 12.175 - } 12.176 - 12.177 - @Override 12.178 - public void contextDestroyed(ServletContextEvent sce) { 12.179 - dataSource = null; 12.180 - } 12.181 -}
13.1 --- a/src/java/de/uapcore/lightpit/Functions.java Sun Apr 08 16:51:15 2018 +0200 13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 13.3 @@ -1,113 +0,0 @@ 13.4 -/* 13.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 13.6 - * 13.7 - * Copyright 2018 Mike Becker. All rights reserved. 13.8 - * 13.9 - * Redistribution and use in source and binary forms, with or without 13.10 - * modification, are permitted provided that the following conditions are met: 13.11 - * 13.12 - * 1. Redistributions of source code must retain the above copyright 13.13 - * notice, this list of conditions and the following disclaimer. 13.14 - * 13.15 - * 2. Redistributions in binary form must reproduce the above copyright 13.16 - * notice, this list of conditions and the following disclaimer in the 13.17 - * documentation and/or other materials provided with the distribution. 13.18 - * 13.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 13.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 13.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 13.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 13.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 13.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 13.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 13.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 13.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 13.29 - * POSSIBILITY OF SUCH DAMAGE. 13.30 - * 13.31 - */ 13.32 -package de.uapcore.lightpit; 13.33 - 13.34 -import java.util.Optional; 13.35 -import javax.servlet.ServletContext; 13.36 -import javax.servlet.http.HttpServletRequest; 13.37 -import org.slf4j.Logger; 13.38 -import org.slf4j.LoggerFactory; 13.39 - 13.40 -/** 13.41 - * Contains common static functions. 13.42 - */ 13.43 -public final class Functions { 13.44 - 13.45 - private static final Logger LOG = LoggerFactory.getLogger(Functions.class); 13.46 - 13.47 - public static Optional<String[]> availableLanguages(ServletContext ctx) { 13.48 - return Optional.ofNullable(ctx.getInitParameter(Constants.CTX_ATTR_LANGUAGES)).map((x) -> x.split("\\s*,\\s*")); 13.49 - } 13.50 - 13.51 - public static String enforceExt(String filename, String ext) { 13.52 - return filename.endsWith(ext) ? filename : filename + ext; 13.53 - } 13.54 - 13.55 - public static String jspPath(String filename) { 13.56 - return enforceExt(Constants.JSP_PATH_PREFIX + filename, ".jsp"); 13.57 - } 13.58 - 13.59 - public static String jspfPath(String filename) { 13.60 - return enforceExt(Constants.JSPF_PATH_PREFIX + filename, ".jspf"); 13.61 - } 13.62 - 13.63 - public static String dynFragmentPath(String filename) { 13.64 - return enforceExt(Constants.DYN_FRAGMENT_PATH_PREFIX + filename, ".jsp"); 13.65 - } 13.66 - 13.67 - public static String fqn(String base, String name) { 13.68 - return base+"."+name; 13.69 - } 13.70 - 13.71 - public static String fqn(Class clazz, String name) { 13.72 - return fqn(clazz.getName(), name); 13.73 - } 13.74 - 13.75 - public static String fullPath(LightPITModule module, RequestMapping mapping) { 13.76 - StringBuilder sb = new StringBuilder(); 13.77 - sb.append(module.modulePath()); 13.78 - sb.append('/'); 13.79 - if (!mapping.requestPath().isEmpty()) { 13.80 - sb.append(mapping.requestPath().isEmpty()); 13.81 - sb.append('/'); 13.82 - } 13.83 - return sb.toString(); 13.84 - } 13.85 - 13.86 - public static String fullPath(HttpServletRequest req) { 13.87 - return req.getServletPath() + Optional.ofNullable(req.getPathInfo()).orElse(""); 13.88 - } 13.89 - 13.90 - /** 13.91 - * Returns the module path of the given LightPIT Servlet module. 13.92 - * 13.93 - * If you specify a malformed LightPIT servlet, which does not have a module 13.94 - * annotation, the path to the <code>/error/404.html</code> page is returned. 13.95 - * 13.96 - * @param clazz the servlet class 13.97 - * @return the module path 13.98 - */ 13.99 - public static String modulePathOf(Class<? extends AbstractLightPITServlet> clazz) { 13.100 - Optional<LightPITModule> moduleInfo = Optional.ofNullable(clazz.getAnnotation(LightPITModule.class)); 13.101 - if (moduleInfo.isPresent()) { 13.102 - return moduleInfo.get().modulePath(); 13.103 - } else { 13.104 - LOG.warn( 13.105 - "{} is a LightPIT Servlet but is missing the module annotation.", 13.106 - clazz.getName() 13.107 - ); 13.108 - return "/error/404.html"; 13.109 - } 13.110 - } 13.111 - 13.112 - /** 13.113 - * This class is not instantiatable. 13.114 - */ 13.115 - private Functions() {} 13.116 -}
14.1 --- a/src/java/de/uapcore/lightpit/HttpMethod.java Sun Apr 08 16:51:15 2018 +0200 14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 14.3 @@ -1,34 +0,0 @@ 14.4 -/* 14.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 14.6 - * 14.7 - * Copyright 2018 Mike Becker. All rights reserved. 14.8 - * 14.9 - * Redistribution and use in source and binary forms, with or without 14.10 - * modification, are permitted provided that the following conditions are met: 14.11 - * 14.12 - * 1. Redistributions of source code must retain the above copyright 14.13 - * notice, this list of conditions and the following disclaimer. 14.14 - * 14.15 - * 2. Redistributions in binary form must reproduce the above copyright 14.16 - * notice, this list of conditions and the following disclaimer in the 14.17 - * documentation and/or other materials provided with the distribution. 14.18 - * 14.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 14.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 14.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 14.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 14.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 14.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 14.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 14.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 14.29 - * POSSIBILITY OF SUCH DAMAGE. 14.30 - * 14.31 - */ 14.32 -package de.uapcore.lightpit; 14.33 - 14.34 - 14.35 -public enum HttpMethod { 14.36 - GET, POST, PUT, DELETE, TRACE, HEAD, OPTIONS 14.37 -}
15.1 --- a/src/java/de/uapcore/lightpit/LightPITModule.java Sun Apr 08 16:51:15 2018 +0200 15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 15.3 @@ -1,170 +0,0 @@ 15.4 -/* 15.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 15.6 - * 15.7 - * Copyright 2018 Mike Becker. All rights reserved. 15.8 - * 15.9 - * Redistribution and use in source and binary forms, with or without 15.10 - * modification, are permitted provided that the following conditions are met: 15.11 - * 15.12 - * 1. Redistributions of source code must retain the above copyright 15.13 - * notice, this list of conditions and the following disclaimer. 15.14 - * 15.15 - * 2. Redistributions in binary form must reproduce the above copyright 15.16 - * notice, this list of conditions and the following disclaimer in the 15.17 - * documentation and/or other materials provided with the distribution. 15.18 - * 15.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 15.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 15.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 15.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 15.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 15.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 15.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 15.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 15.29 - * POSSIBILITY OF SUCH DAMAGE. 15.30 - * 15.31 - */ 15.32 -package de.uapcore.lightpit; 15.33 - 15.34 -import java.lang.annotation.Documented; 15.35 -import java.lang.annotation.ElementType; 15.36 -import java.lang.annotation.Retention; 15.37 -import java.lang.annotation.RetentionPolicy; 15.38 -import java.lang.annotation.Target; 15.39 -import javax.servlet.annotation.WebServlet; 15.40 - 15.41 - 15.42 -/** 15.43 - * Contains information about a LightPIT module. 15.44 - * 15.45 - * This annotation is typically used to annotate the {@link WebServlet} which 15.46 - * implements the module's functionality. 15.47 - */ 15.48 -@Documented 15.49 -@Retention(RetentionPolicy.RUNTIME) 15.50 -@Target(ElementType.TYPE) 15.51 -public @interface LightPITModule { 15.52 - /** 15.53 - * Base name of the module specific resource bundle. 15.54 - * @return a base name suitable for the JSTL tag 'setBundle'. 15.55 - */ 15.56 - String bundleBaseName(); 15.57 - 15.58 - /** 15.59 - * An array of required modules, identified by the string representation of 15.60 - * their class names. 15.61 - * @return an array of class names of required modules 15.62 - */ 15.63 - String[] requires() default {}; 15.64 - 15.65 - /** 15.66 - * The path for this module, which will also be used for the menu entry. 15.67 - * 15.68 - * This path must adhere to the URL pattern of the Servlet but must not 15.69 - * contain any starting or trailing slashes. 15.70 - * 15.71 - * @return the relative module path 15.72 - */ 15.73 - String modulePath(); 15.74 - 15.75 - /** 15.76 - * Returns the properties key for the module name. 15.77 - * 15.78 - * @return the properties key 15.79 - */ 15.80 - String nameKey() default "name"; 15.81 - 15.82 - /** 15.83 - * Returns the properties key for the module description. 15.84 - * 15.85 - * @return the properties key 15.86 - */ 15.87 - String descKey() default "description"; 15.88 - 15.89 - 15.90 - /** 15.91 - * Returns the properties key for the menu label. 15.92 - * 15.93 - * Set this string to empty string, if the module should be hidden from 15.94 - * the menu. 15.95 - * 15.96 - * @return the properties key 15.97 - */ 15.98 - String menuKey() default "menuLabel"; 15.99 - 15.100 - /** 15.101 - * Returns the properties key for the page title. 15.102 - * 15.103 - * By default this is the same as the menu label. 15.104 - * 15.105 - * @return the properties key 15.106 - */ 15.107 - String titleKey() default "menuLabel"; 15.108 - 15.109 - /** 15.110 - * If set to <code>true</code>, this module is always loaded, but never 15.111 - * visible in the menu or the Web UI module manager. 15.112 - * 15.113 - * @return true, if this is a system module 15.114 - */ 15.115 - boolean systemModule() default false; 15.116 - 15.117 - /** 15.118 - * Class representing the annotation. 15.119 - * This is necessary, because the EL resolver cannot deal with 15.120 - * annotation objects. 15.121 - * 15.122 - * Note, that only the properties which are interesting for the JSP pages 15.123 - * are proxied by this object. 15.124 - */ 15.125 - public static class ELProxy { 15.126 - private final String bundleBaseName, modulePath, menuKey, titleKey, nameKey, descKey; 15.127 - 15.128 - public static ELProxy convert(LightPITModule annotation) { 15.129 - return new ELProxy( 15.130 - annotation.bundleBaseName(), 15.131 - annotation.modulePath(), 15.132 - annotation.menuKey(), 15.133 - annotation.titleKey(), 15.134 - annotation.nameKey(), 15.135 - annotation.descKey() 15.136 - ); 15.137 - } 15.138 - 15.139 - private ELProxy(String bundleBaseName, String modulePath, String menuKey, String titleKey, String nameKey, String descKey) { 15.140 - this.bundleBaseName = bundleBaseName; 15.141 - this.modulePath = modulePath; 15.142 - this.menuKey = menuKey; 15.143 - this.titleKey = titleKey; 15.144 - this.nameKey = nameKey; 15.145 - this.descKey = descKey; 15.146 - } 15.147 - 15.148 - public String getBundleBaseName() { 15.149 - return bundleBaseName; 15.150 - } 15.151 - 15.152 - public String getMenuKey() { 15.153 - return menuKey; 15.154 - } 15.155 - 15.156 - public String getModulePath() { 15.157 - return modulePath; 15.158 - } 15.159 - 15.160 - public String getTitleKey() { 15.161 - return titleKey; 15.162 - } 15.163 - 15.164 - public String getNameKey() { 15.165 - return nameKey; 15.166 - } 15.167 - 15.168 - public String getDescKey() { 15.169 - return descKey; 15.170 - } 15.171 - 15.172 - } 15.173 -}
16.1 --- a/src/java/de/uapcore/lightpit/Menu.java Sun Apr 08 16:51:15 2018 +0200 16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 16.3 @@ -1,97 +0,0 @@ 16.4 -/* 16.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 16.6 - * 16.7 - * Copyright 2018 Mike Becker. All rights reserved. 16.8 - * 16.9 - * Redistribution and use in source and binary forms, with or without 16.10 - * modification, are permitted provided that the following conditions are met: 16.11 - * 16.12 - * 1. Redistributions of source code must retain the above copyright 16.13 - * notice, this list of conditions and the following disclaimer. 16.14 - * 16.15 - * 2. Redistributions in binary form must reproduce the above copyright 16.16 - * notice, this list of conditions and the following disclaimer in the 16.17 - * documentation and/or other materials provided with the distribution. 16.18 - * 16.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 16.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 16.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 16.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 16.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 16.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 16.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 16.29 - * POSSIBILITY OF SUCH DAMAGE. 16.30 - * 16.31 - */ 16.32 -package de.uapcore.lightpit; 16.33 - 16.34 -import java.util.ArrayList; 16.35 -import java.util.Collections; 16.36 -import java.util.List; 16.37 - 16.38 -/** 16.39 - * Maps a resource key for the menu label to the path name for the underlying 16.40 - * site. 16.41 - * 16.42 - * Objects of this class are internally instantiated by the 16.43 - * {@link ModuleManager}. 16.44 - */ 16.45 -public class Menu extends MenuEntry { 16.46 - 16.47 - private final List<MenuEntry> entries = new ArrayList<>(); 16.48 - private final List<MenuEntry> immutableEntries = Collections.unmodifiableList(entries); 16.49 - 16.50 - /** 16.51 - * Class name of the module for which this menu is built. 16.52 - */ 16.53 - private String moduleClassName; 16.54 - 16.55 - 16.56 - public Menu() { 16.57 - super(); 16.58 - } 16.59 - 16.60 - public Menu(String moduleClassName, ResourceKey resourceKey, String pathName) { 16.61 - super(resourceKey, pathName); 16.62 - this.moduleClassName = moduleClassName; 16.63 - } 16.64 - 16.65 - public void setModuleClassName(String moduleClassName) { 16.66 - this.moduleClassName = moduleClassName; 16.67 - } 16.68 - 16.69 - public String getModuleClassName() { 16.70 - return moduleClassName; 16.71 - } 16.72 - 16.73 - /** 16.74 - * Sets a new list of menu entries for this menu. 16.75 - * 16.76 - * @param entries the list of new menu entries 16.77 - */ 16.78 - public void setEntries(List<MenuEntry> entries) { 16.79 - // in case the given list is immutable, we copy the contents 16.80 - this.entries.clear(); 16.81 - this.entries.addAll(entries); 16.82 - } 16.83 - 16.84 - /** 16.85 - * Retrieves an immutable list of menu entries for this menu. 16.86 - * 16.87 - * @return the list of menu entries 16.88 - */ 16.89 - public List<MenuEntry> getEntries() { 16.90 - return immutableEntries; 16.91 - } 16.92 - 16.93 - /** 16.94 - * Adds a new menu entry to this menu. 16.95 - * @param entry the menu entry to add 16.96 - */ 16.97 - public void addMenuEntry(MenuEntry entry) { 16.98 - entries.add(entry); 16.99 - } 16.100 -}
17.1 --- a/src/java/de/uapcore/lightpit/MenuEntry.java Sun Apr 08 16:51:15 2018 +0200 17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 17.3 @@ -1,74 +0,0 @@ 17.4 -/* 17.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 17.6 - * 17.7 - * Copyright 2018 Mike Becker. All rights reserved. 17.8 - * 17.9 - * Redistribution and use in source and binary forms, with or without 17.10 - * modification, are permitted provided that the following conditions are met: 17.11 - * 17.12 - * 1. Redistributions of source code must retain the above copyright 17.13 - * notice, this list of conditions and the following disclaimer. 17.14 - * 17.15 - * 2. Redistributions in binary form must reproduce the above copyright 17.16 - * notice, this list of conditions and the following disclaimer in the 17.17 - * documentation and/or other materials provided with the distribution. 17.18 - * 17.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 17.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 17.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 17.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 17.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 17.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 17.29 - * POSSIBILITY OF SUCH DAMAGE. 17.30 - * 17.31 - */ 17.32 -package de.uapcore.lightpit; 17.33 - 17.34 -/** 17.35 - * Maps a resource key for the menu label to the path name for the underlying 17.36 - * site. 17.37 - * 17.38 - * Objects of this class are internally instantiated by the 17.39 - * {@link ModuleManager}. 17.40 - */ 17.41 -public class MenuEntry { 17.42 - 17.43 - /** 17.44 - * Resource key for the menu label. 17.45 - */ 17.46 - private ResourceKey resourceKey; 17.47 - 17.48 - /** 17.49 - * Path name of the module, linked by this menu entry. 17.50 - */ 17.51 - private String pathName; 17.52 - 17.53 - public MenuEntry() { 17.54 - } 17.55 - 17.56 - public MenuEntry(ResourceKey resourceKey, String pathName) { 17.57 - this.resourceKey = resourceKey; 17.58 - this.pathName = pathName; 17.59 - } 17.60 - 17.61 - public void setResourceKey(ResourceKey resourceKey) { 17.62 - this.resourceKey = resourceKey; 17.63 - } 17.64 - 17.65 - public ResourceKey getResourceKey() { 17.66 - return resourceKey; 17.67 - } 17.68 - 17.69 - public void setPathName(String pathName) { 17.70 - this.pathName = pathName; 17.71 - } 17.72 - 17.73 - public String getPathName() { 17.74 - return pathName; 17.75 - } 17.76 - 17.77 -}
18.1 --- a/src/java/de/uapcore/lightpit/ModuleManager.java Sun Apr 08 16:51:15 2018 +0200 18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 18.3 @@ -1,231 +0,0 @@ 18.4 -/* 18.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 18.6 - * 18.7 - * Copyright 2018 Mike Becker. All rights reserved. 18.8 - * 18.9 - * Redistribution and use in source and binary forms, with or without 18.10 - * modification, are permitted provided that the following conditions are met: 18.11 - * 18.12 - * 1. Redistributions of source code must retain the above copyright 18.13 - * notice, this list of conditions and the following disclaimer. 18.14 - * 18.15 - * 2. Redistributions in binary form must reproduce the above copyright 18.16 - * notice, this list of conditions and the following disclaimer in the 18.17 - * documentation and/or other materials provided with the distribution. 18.18 - * 18.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 18.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 18.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 18.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 18.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 18.29 - * POSSIBILITY OF SUCH DAMAGE. 18.30 - * 18.31 - */ 18.32 -package de.uapcore.lightpit; 18.33 - 18.34 -import de.uapcore.lightpit.entities.CoreDAOFactory; 18.35 -import de.uapcore.lightpit.entities.Module; 18.36 -import de.uapcore.lightpit.entities.ModuleDao; 18.37 -import java.sql.Connection; 18.38 -import java.sql.SQLException; 18.39 -import java.util.Collections; 18.40 -import java.util.HashMap; 18.41 -import java.util.List; 18.42 -import java.util.Map; 18.43 -import java.util.Optional; 18.44 -import java.util.concurrent.atomic.AtomicBoolean; 18.45 -import java.util.stream.Collectors; 18.46 -import javax.servlet.Registration; 18.47 -import javax.servlet.ServletContext; 18.48 -import javax.servlet.ServletContextEvent; 18.49 -import javax.servlet.ServletContextListener; 18.50 -import javax.servlet.annotation.WebListener; 18.51 -import org.slf4j.Logger; 18.52 -import org.slf4j.LoggerFactory; 18.53 - 18.54 -/** 18.55 - * Scans registered servlets for LightPIT modules. 18.56 - */ 18.57 -@WebListener 18.58 -public final class ModuleManager implements ServletContextListener { 18.59 - 18.60 - private static final Logger LOG = LoggerFactory.getLogger(ModuleManager.class); 18.61 - 18.62 - /** 18.63 - * The attribute name in the servlet context under which an instance of this class can be found. 18.64 - */ 18.65 - public static final String SC_ATTR_NAME = ModuleManager.class.getName(); 18.66 - private ServletContext sc; 18.67 - 18.68 - /** 18.69 - * Maps class names to module information. 18.70 - */ 18.71 - private final Map<String, LightPITModule> registeredModules = new HashMap<>(); 18.72 - 18.73 - /** 18.74 - * This flag is true, when synchronization is needed. 18.75 - */ 18.76 - private final AtomicBoolean dirty = new AtomicBoolean(true); 18.77 - 18.78 - @Override 18.79 - public void contextInitialized(ServletContextEvent sce) { 18.80 - sc = sce.getServletContext(); 18.81 - reloadAll(); 18.82 - sc.setAttribute(SC_ATTR_NAME, this); 18.83 - LOG.info("Module manager injected into ServletContext."); 18.84 - } 18.85 - 18.86 - @Override 18.87 - public void contextDestroyed(ServletContextEvent sce) { 18.88 - unloadAll(); 18.89 - } 18.90 - 18.91 - private Optional<LightPITModule> getModuleInfo(Registration reg) { 18.92 - try { 18.93 - final Class scclass = Class.forName(reg.getClassName()); 18.94 - 18.95 - final boolean lpservlet = AbstractLightPITServlet.class.isAssignableFrom(scclass); 18.96 - final boolean lpmodule = scclass.isAnnotationPresent(LightPITModule.class); 18.97 - 18.98 - if (lpservlet && !lpmodule) { 18.99 - LOG.warn( 18.100 - "{} is a LightPIT Servlet but is missing the module annotation.", 18.101 - reg.getClassName() 18.102 - ); 18.103 - } else if (!lpservlet && lpmodule) { 18.104 - LOG.warn( 18.105 - "{} is annotated as a LightPIT Module but does not extend {}.", 18.106 - reg.getClassName(), 18.107 - AbstractLightPITServlet.class.getSimpleName() 18.108 - ); 18.109 - } 18.110 - 18.111 - if (lpservlet && lpmodule) { 18.112 - final Class<? extends AbstractLightPITServlet> clazz = scclass; 18.113 - final LightPITModule moduleInfo = clazz.getAnnotation(LightPITModule.class); 18.114 - return Optional.of(moduleInfo); 18.115 - } else { 18.116 - return Optional.empty(); 18.117 - } 18.118 - } catch (ClassNotFoundException ex) { 18.119 - LOG.error( 18.120 - "Servlet registration refers to class {} which cannot be found by the class loader (Reason: {})", 18.121 - reg.getClassName(), 18.122 - ex.getMessage() 18.123 - ); 18.124 - return Optional.empty(); 18.125 - } 18.126 - } 18.127 - 18.128 - private void handleServletRegistration(String name, Registration reg) { 18.129 - final Optional<LightPITModule> moduleInfo = getModuleInfo(reg); 18.130 - if (moduleInfo.isPresent()) { 18.131 - registeredModules.put(reg.getClassName(), moduleInfo.get()); 18.132 - LOG.info("Module detected: {}", name); 18.133 - } else { 18.134 - LOG.debug("Servlet {} is no module, skipping.", name); 18.135 - } 18.136 - } 18.137 - 18.138 - /** 18.139 - * Scans for modules and reloads them all. 18.140 - */ 18.141 - public void reloadAll() { 18.142 - registeredModules.clear(); 18.143 - sc.getServletRegistrations().forEach(this::handleServletRegistration); 18.144 - 18.145 - // TODO: implement dependency resolver 18.146 - 18.147 - dirty.set(true); 18.148 - LOG.info("Modules loaded."); 18.149 - } 18.150 - 18.151 - /** 18.152 - * Synchronizes module information with the database. 18.153 - * 18.154 - * This must be called from the {@link AbstractLightPITServlet}. 18.155 - * Admittedly the call will perform the synchronization once after reload 18.156 - * and be a no-op, afterwards. 18.157 - * However, we since the DatabaseFacade might be loaded after the module 18.158 - * manager, we must defer the synchronization to the first request 18.159 - * handled by the Servlet. 18.160 - * 18.161 - * @param db interface to the database 18.162 - */ 18.163 - public void syncWithDatabase(DatabaseFacade db) { 18.164 - if (dirty.compareAndSet(true, false)) { 18.165 - if (db.getDataSource().isPresent()) { 18.166 - try (Connection conn = db.getDataSource().get().getConnection()) { 18.167 - final ModuleDao moduleDao = CoreDAOFactory.getModuleDao(db.getSQLDialect()); 18.168 - moduleDao.syncRegisteredModuleClasses(conn, registeredModules.entrySet()); 18.169 - } catch (SQLException ex) { 18.170 - LOG.error("Unexpected SQL Exception", ex); 18.171 - } 18.172 - } else { 18.173 - LOG.error("No datasource present. Cannot sync module information with database."); 18.174 - } 18.175 - } else { 18.176 - LOG.trace("Module information clean - no synchronization required."); 18.177 - } 18.178 - } 18.179 - 18.180 - /** 18.181 - * Unloads all found modules. 18.182 - */ 18.183 - public void unloadAll() { 18.184 - registeredModules.clear(); 18.185 - LOG.info("All modules unloaded."); 18.186 - } 18.187 - 18.188 - /** 18.189 - * Returns the main menu. 18.190 - * 18.191 - * @param db the interface to the database 18.192 - * @return a list of menus belonging to the main menu 18.193 - */ 18.194 - public List<Menu> getMainMenu(DatabaseFacade db) { 18.195 - // TODO: user specific menu 18.196 - 18.197 - if (db.getDataSource().isPresent()) { 18.198 - try (Connection conn = db.getDataSource().get().getConnection()) { 18.199 - final ModuleDao dao = CoreDAOFactory.getModuleDao(db.getSQLDialect()); 18.200 - final List<Module> modules = dao.listAll(conn); 18.201 - 18.202 - final List<Menu> menu = modules 18.203 - .stream() 18.204 - .filter((mod) -> mod.isVisible()) 18.205 - .collect(Collectors.mapping( 18.206 - (mod) -> new Menu( 18.207 - mod.getClassname(), 18.208 - new ResourceKey( 18.209 - registeredModules.get(mod.getClassname()).bundleBaseName(), 18.210 - registeredModules.get(mod.getClassname()).menuKey()), 18.211 - registeredModules.get(mod.getClassname()).modulePath()), 18.212 - Collectors.toList()) 18.213 - ); 18.214 - return menu; 18.215 - } catch (SQLException ex) { 18.216 - LOG.error("Unexpected SQLException when loading the main menu", ex); 18.217 - return Collections.emptyList(); 18.218 - } 18.219 - } else { 18.220 - return Collections.emptyList(); 18.221 - } 18.222 - } 18.223 - 18.224 - /** 18.225 - * Returns an unmodifiable map of all registered modules. 18.226 - * 18.227 - * The key is the classname of the module. 18.228 - * 18.229 - * @return the map of registered modules 18.230 - */ 18.231 - public Map<String, LightPITModule> getRegisteredModules() { 18.232 - return Collections.unmodifiableMap(registeredModules); 18.233 - } 18.234 -}
19.1 --- a/src/java/de/uapcore/lightpit/RequestMapping.java Sun Apr 08 16:51:15 2018 +0200 19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 19.3 @@ -1,76 +0,0 @@ 19.4 -/* 19.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 19.6 - * 19.7 - * Copyright 2018 Mike Becker. All rights reserved. 19.8 - * 19.9 - * Redistribution and use in source and binary forms, with or without 19.10 - * modification, are permitted provided that the following conditions are met: 19.11 - * 19.12 - * 1. Redistributions of source code must retain the above copyright 19.13 - * notice, this list of conditions and the following disclaimer. 19.14 - * 19.15 - * 2. Redistributions in binary form must reproduce the above copyright 19.16 - * notice, this list of conditions and the following disclaimer in the 19.17 - * documentation and/or other materials provided with the distribution. 19.18 - * 19.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 19.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 19.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 19.29 - * POSSIBILITY OF SUCH DAMAGE. 19.30 - * 19.31 - */ 19.32 -package de.uapcore.lightpit; 19.33 - 19.34 -import java.lang.annotation.Documented; 19.35 -import java.lang.annotation.ElementType; 19.36 -import java.lang.annotation.Retention; 19.37 -import java.lang.annotation.RetentionPolicy; 19.38 -import java.lang.annotation.Target; 19.39 - 19.40 - 19.41 -/** 19.42 - * Maps requests to methods. 19.43 - * 19.44 - * This annotation is used to annotate methods within classes which 19.45 - * override {@link AbstractLightPITServlet}. 19.46 - */ 19.47 -@Documented 19.48 -@Retention(RetentionPolicy.RUNTIME) 19.49 -@Target(ElementType.METHOD) 19.50 -public @interface RequestMapping { 19.51 - 19.52 - /** 19.53 - * Specifies the HTTP method. 19.54 - * 19.55 - * @return the HTTP method handled by the annotated Java method 19.56 - */ 19.57 - HttpMethod method(); 19.58 - 19.59 - /** 19.60 - * Specifies the request path relative to the module path. 19.61 - * 19.62 - * If a menu key is specified, this is also the path, which is linked 19.63 - * by the menu entry. 19.64 - * 19.65 - * The path must be specified <em>without</em> leading and trailing slash. 19.66 - * 19.67 - * @return the request path the annotated method should handle 19.68 - */ 19.69 - String requestPath() default ""; 19.70 - 19.71 - /** 19.72 - * Returns the properties key for the (sub) menu label. 19.73 - * 19.74 - * This should only be used for {@link HttpMethod#GET} requests. 19.75 - * 19.76 - * @return the properties key 19.77 - */ 19.78 - String menuKey() default ""; 19.79 -}
20.1 --- a/src/java/de/uapcore/lightpit/ResourceKey.java Sun Apr 08 16:51:15 2018 +0200 20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 20.3 @@ -1,62 +0,0 @@ 20.4 -/* 20.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 20.6 - * 20.7 - * Copyright 2018 Mike Becker. All rights reserved. 20.8 - * 20.9 - * Redistribution and use in source and binary forms, with or without 20.10 - * modification, are permitted provided that the following conditions are met: 20.11 - * 20.12 - * 1. Redistributions of source code must retain the above copyright 20.13 - * notice, this list of conditions and the following disclaimer. 20.14 - * 20.15 - * 2. Redistributions in binary form must reproduce the above copyright 20.16 - * notice, this list of conditions and the following disclaimer in the 20.17 - * documentation and/or other materials provided with the distribution. 20.18 - * 20.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 20.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 20.29 - * POSSIBILITY OF SUCH DAMAGE. 20.30 - * 20.31 - */ 20.32 -package de.uapcore.lightpit; 20.33 - 20.34 -/** 20.35 - * Fully specifies a resource key by the bundle and the key name. 20.36 - */ 20.37 -public final class ResourceKey { 20.38 - private String bundle; 20.39 - private String key; 20.40 - 20.41 - public ResourceKey() { 20.42 - 20.43 - } 20.44 - 20.45 - public ResourceKey(String bundle, String key) { 20.46 - this.bundle = bundle; 20.47 - this.key = key; 20.48 - } 20.49 - 20.50 - public void setBundle(String bundle) { 20.51 - this.bundle = bundle; 20.52 - } 20.53 - 20.54 - public String getBundle() { 20.55 - return bundle; 20.56 - } 20.57 - 20.58 - public void setKey(String key) { 20.59 - this.key = key; 20.60 - } 20.61 - 20.62 - public String getKey() { 20.63 - return key; 20.64 - } 20.65 -}
21.1 --- a/src/java/de/uapcore/lightpit/ResponseType.java Sun Apr 08 16:51:15 2018 +0200 21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 21.3 @@ -1,56 +0,0 @@ 21.4 -/* 21.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 21.6 - * 21.7 - * Copyright 2018 Mike Becker. All rights reserved. 21.8 - * 21.9 - * Redistribution and use in source and binary forms, with or without 21.10 - * modification, are permitted provided that the following conditions are met: 21.11 - * 21.12 - * 1. Redistributions of source code must retain the above copyright 21.13 - * notice, this list of conditions and the following disclaimer. 21.14 - * 21.15 - * 2. Redistributions in binary form must reproduce the above copyright 21.16 - * notice, this list of conditions and the following disclaimer in the 21.17 - * documentation and/or other materials provided with the distribution. 21.18 - * 21.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 21.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 21.29 - * POSSIBILITY OF SUCH DAMAGE. 21.30 - * 21.31 - */ 21.32 -package de.uapcore.lightpit; 21.33 - 21.34 - 21.35 -public enum ResponseType { 21.36 - /** 21.37 - * Renders a full HTML view including the header. 21.38 - */ 21.39 - HTML_FULL, 21.40 - /** 21.41 - * Renders a HTML fragment only. 21.42 - * May be used for AJAX responses. 21.43 - */ 21.44 - HTML_FRAGMENT, 21.45 - /** 21.46 - * Returns a fragment with content type 'text/plain'. 21.47 - */ 21.48 - PLAIN, 21.49 - /** 21.50 - * Returns an object in JSON format and with content type 21.51 - * 'application/json'. 21.52 - */ 21.53 - JSON, 21.54 - /** 21.55 - * The handler already sent the output, nothing should be done 21.56 - * additionally by the Servlet. 21.57 - */ 21.58 - NONE 21.59 -}
22.1 --- a/src/java/de/uapcore/lightpit/entities/CoreDAOFactory.java Sun Apr 08 16:51:15 2018 +0200 22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 22.3 @@ -1,47 +0,0 @@ 22.4 -/* 22.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 22.6 - * 22.7 - * Copyright 2018 Mike Becker. All rights reserved. 22.8 - * 22.9 - * Redistribution and use in source and binary forms, with or without 22.10 - * modification, are permitted provided that the following conditions are met: 22.11 - * 22.12 - * 1. Redistributions of source code must retain the above copyright 22.13 - * notice, this list of conditions and the following disclaimer. 22.14 - * 22.15 - * 2. Redistributions in binary form must reproduce the above copyright 22.16 - * notice, this list of conditions and the following disclaimer in the 22.17 - * documentation and/or other materials provided with the distribution. 22.18 - * 22.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 22.29 - * POSSIBILITY OF SUCH DAMAGE. 22.30 - * 22.31 - */ 22.32 -package de.uapcore.lightpit.entities; 22.33 - 22.34 -import de.uapcore.lightpit.DatabaseFacade; 22.35 - 22.36 -public final class CoreDAOFactory { 22.37 - 22.38 - private CoreDAOFactory() {} 22.39 - 22.40 - private static class PostgresDaos { 22.41 - static final ModuleDao MODULE_DAO = new PostgresModuleDao(); 22.42 - } 22.43 - 22.44 - public static ModuleDao getModuleDao(DatabaseFacade.Dialect dialect) { 22.45 - switch (dialect) { 22.46 - case Postgres: return PostgresDaos.MODULE_DAO; 22.47 - default: assert(false); return null; 22.48 - } 22.49 - } 22.50 -}
23.1 --- a/src/java/de/uapcore/lightpit/entities/Module.java Sun Apr 08 16:51:15 2018 +0200 23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 23.3 @@ -1,90 +0,0 @@ 23.4 -/* 23.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 23.6 - * 23.7 - * Copyright 2018 Mike Becker. All rights reserved. 23.8 - * 23.9 - * Redistribution and use in source and binary forms, with or without 23.10 - * modification, are permitted provided that the following conditions are met: 23.11 - * 23.12 - * 1. Redistributions of source code must retain the above copyright 23.13 - * notice, this list of conditions and the following disclaimer. 23.14 - * 23.15 - * 2. Redistributions in binary form must reproduce the above copyright 23.16 - * notice, this list of conditions and the following disclaimer in the 23.17 - * documentation and/or other materials provided with the distribution. 23.18 - * 23.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 23.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 23.29 - * POSSIBILITY OF SUCH DAMAGE. 23.30 - * 23.31 - */ 23.32 -package de.uapcore.lightpit.entities; 23.33 - 23.34 -import de.uapcore.lightpit.LightPITModule; 23.35 - 23.36 -public final class Module { 23.37 - private int modID; 23.38 - private String classname; 23.39 - private boolean visible; 23.40 - 23.41 - private LightPITModule.ELProxy annotatedInfos; 23.42 - 23.43 - public int getModID() { 23.44 - return modID; 23.45 - } 23.46 - 23.47 - public void setModID(int modID) { 23.48 - this.modID = modID; 23.49 - } 23.50 - 23.51 - public String getClassname() { 23.52 - return classname; 23.53 - } 23.54 - 23.55 - public void setClassname(String classname) { 23.56 - this.classname = classname; 23.57 - } 23.58 - 23.59 - public boolean isVisible() { 23.60 - return visible; 23.61 - } 23.62 - 23.63 - public void setVisible(boolean visible) { 23.64 - this.visible = visible; 23.65 - } 23.66 - 23.67 - public LightPITModule.ELProxy getAnnotatedInfos() { 23.68 - return annotatedInfos; 23.69 - } 23.70 - 23.71 - public void setAnnotatedInfos(LightPITModule.ELProxy annotatedInfos) { 23.72 - this.annotatedInfos = annotatedInfos; 23.73 - } 23.74 - 23.75 - @Override 23.76 - public int hashCode() { 23.77 - int hash = 3; 23.78 - hash = 41 * hash + this.modID; 23.79 - return hash; 23.80 - } 23.81 - 23.82 - @Override 23.83 - public boolean equals(Object obj) { 23.84 - if (this == obj) { 23.85 - return true; 23.86 - } 23.87 - if (obj == null || getClass() != obj.getClass()) { 23.88 - return false; 23.89 - } else { 23.90 - return this.modID == ((Module) obj).modID; 23.91 - } 23.92 - } 23.93 -}
24.1 --- a/src/java/de/uapcore/lightpit/entities/ModuleDao.java Sun Apr 08 16:51:15 2018 +0200 24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 24.3 @@ -1,141 +0,0 @@ 24.4 -/* 24.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 24.6 - * 24.7 - * Copyright 2018 Mike Becker. All rights reserved. 24.8 - * 24.9 - * Redistribution and use in source and binary forms, with or without 24.10 - * modification, are permitted provided that the following conditions are met: 24.11 - * 24.12 - * 1. Redistributions of source code must retain the above copyright 24.13 - * notice, this list of conditions and the following disclaimer. 24.14 - * 24.15 - * 2. Redistributions in binary form must reproduce the above copyright 24.16 - * notice, this list of conditions and the following disclaimer in the 24.17 - * documentation and/or other materials provided with the distribution. 24.18 - * 24.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 24.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24.29 - * POSSIBILITY OF SUCH DAMAGE. 24.30 - * 24.31 - */ 24.32 -package de.uapcore.lightpit.entities; 24.33 - 24.34 -import de.uapcore.lightpit.LightPITModule; 24.35 -import java.sql.Connection; 24.36 -import java.sql.PreparedStatement; 24.37 -import java.sql.ResultSet; 24.38 -import java.sql.SQLException; 24.39 -import java.sql.Statement; 24.40 -import java.util.ArrayList; 24.41 -import java.util.List; 24.42 -import java.util.Map; 24.43 -import java.util.Set; 24.44 - 24.45 -public abstract class ModuleDao { 24.46 - 24.47 - /** 24.48 - * Maps database columns to POJO fields. 24.49 - * @param result the database result set 24.50 - * @param mod the POJO 24.51 - * @throws SQLException 24.52 - */ 24.53 - protected void mapColumns(ResultSet result, Module mod) throws SQLException { 24.54 - mod.setModID(result.getInt("modid")); 24.55 - mod.setClassname(result.getString("classname")); 24.56 - mod.setVisible(result.getBoolean("visible")); 24.57 - } 24.58 - 24.59 - 24.60 - /** 24.61 - * Must return a prepared statement for a single object query with the specified properties. 24.62 - * 24.63 - * <ul> 24.64 - * <li>Parameter 1: classname</li> 24.65 - * <li>Result field 1: visible</li> 24.66 - * </ul> 24.67 - * 24.68 - * @param conn the connection to use 24.69 - * @return the prepared statement 24.70 - * @throws SQLException 24.71 - */ 24.72 - protected PreparedStatement moduleCheckStatement(Connection conn) throws SQLException { 24.73 - return conn.prepareStatement("SELECT visible FROM lpitcore_module WHERE classname = ?"); 24.74 - } 24.75 - 24.76 - /** 24.77 - * Must return a prepared statement for insertion with the specified properties. 24.78 - * 24.79 - * <ul> 24.80 - * <li>Parameter 1: classname</li> 24.81 - * <li>Parameter 2: visible</li> 24.82 - * </ul> 24.83 - * 24.84 - * @param conn the connection to use 24.85 - * @return the prepared statement 24.86 - * @throws SQLException 24.87 - */ 24.88 - protected PreparedStatement moduleInsertStatement(Connection conn) throws SQLException { 24.89 - return conn.prepareStatement("INSERT INTO lpitcore_module (classname, visible) VALUES (?, ?)"); 24.90 - } 24.91 - 24.92 - /** 24.93 - * Synchronizes a set of registered module classes with the database. 24.94 - * 24.95 - * Inserts module classes which are not known to the database and sets them to be visible by default. 24.96 - * Module classes known to the database, which are not in the given set, are ignored. 24.97 - * 24.98 - * @param conn the connection to use 24.99 - * @param moduleSet the module set to synchronize 24.100 - * @throws SQLException 24.101 - */ 24.102 - public final void syncRegisteredModuleClasses(Connection conn, Set<Map.Entry<String, LightPITModule>> moduleSet) throws SQLException { 24.103 - 24.104 - PreparedStatement 24.105 - check = moduleCheckStatement(conn), 24.106 - insert = moduleInsertStatement(conn); 24.107 - insert.setBoolean(2, true); 24.108 - // update/delete not required, we do this in the module management UI 24.109 - 24.110 - for (Map.Entry<String, LightPITModule> modEntry : moduleSet) { 24.111 - if (modEntry.getValue().systemModule()) continue; 24.112 - 24.113 - check.setString(1, modEntry.getKey()); 24.114 - try (ResultSet r = check.executeQuery()) { 24.115 - if (!r.next()) { 24.116 - insert.setString(1, modEntry.getKey()); 24.117 - insert.executeUpdate(); 24.118 - } 24.119 - } 24.120 - } 24.121 - } 24.122 - 24.123 - /** 24.124 - * Returns a list of all modules known by the database. 24.125 - * 24.126 - * Keep in mind, that system modules are never known to the database. 24.127 - * 24.128 - * @param conn the connection to use 24.129 - * @return a list of all modules known by the database 24.130 - * @throws SQLException 24.131 - */ 24.132 - public List<Module> listAll(Connection conn) throws SQLException { 24.133 - List<Module> list = new ArrayList<>(); 24.134 - try (Statement stmt = conn.createStatement(); 24.135 - ResultSet result = stmt.executeQuery("SELECT * FROM lpitcore_module")) { 24.136 - while (result.next()) { 24.137 - final Module mod = new Module(); 24.138 - mapColumns(result, mod); 24.139 - list.add(mod); 24.140 - } 24.141 - } 24.142 - return list; 24.143 - } 24.144 -}
25.1 --- a/src/java/de/uapcore/lightpit/entities/PostgresModuleDao.java Sun Apr 08 16:51:15 2018 +0200 25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 25.3 @@ -1,33 +0,0 @@ 25.4 -/* 25.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 25.6 - * 25.7 - * Copyright 2018 Mike Becker. All rights reserved. 25.8 - * 25.9 - * Redistribution and use in source and binary forms, with or without 25.10 - * modification, are permitted provided that the following conditions are met: 25.11 - * 25.12 - * 1. Redistributions of source code must retain the above copyright 25.13 - * notice, this list of conditions and the following disclaimer. 25.14 - * 25.15 - * 2. Redistributions in binary form must reproduce the above copyright 25.16 - * notice, this list of conditions and the following disclaimer in the 25.17 - * documentation and/or other materials provided with the distribution. 25.18 - * 25.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25.29 - * POSSIBILITY OF SUCH DAMAGE. 25.30 - * 25.31 - */ 25.32 -package de.uapcore.lightpit.entities; 25.33 - 25.34 -public class PostgresModuleDao extends ModuleDao { 25.35 - // No overrides needed. 25.36 -}
26.1 --- a/src/java/de/uapcore/lightpit/entities/User.java Sun Apr 08 16:51:15 2018 +0200 26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 26.3 @@ -1,92 +0,0 @@ 26.4 -/* 26.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 26.6 - * 26.7 - * Copyright 2018 Mike Becker. All rights reserved. 26.8 - * 26.9 - * Redistribution and use in source and binary forms, with or without 26.10 - * modification, are permitted provided that the following conditions are met: 26.11 - * 26.12 - * 1. Redistributions of source code must retain the above copyright 26.13 - * notice, this list of conditions and the following disclaimer. 26.14 - * 26.15 - * 2. Redistributions in binary form must reproduce the above copyright 26.16 - * notice, this list of conditions and the following disclaimer in the 26.17 - * documentation and/or other materials provided with the distribution. 26.18 - * 26.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 26.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26.29 - * POSSIBILITY OF SUCH DAMAGE. 26.30 - * 26.31 - */ 26.32 -package de.uapcore.lightpit.entities; 26.33 - 26.34 -import java.util.Optional; 26.35 - 26.36 -public final class User { 26.37 - 26.38 - public static final int ANONYMOUS_USERID = -1; 26.39 - 26.40 - private int userID; 26.41 - private String username; 26.42 - private Optional<String> givenname; 26.43 - private Optional<String> lastname; 26.44 - 26.45 - public int getUserID() { 26.46 - return userID; 26.47 - } 26.48 - 26.49 - public void setUserID(int userID) { 26.50 - this.userID = userID; 26.51 - } 26.52 - 26.53 - public String getUsername() { 26.54 - return username; 26.55 - } 26.56 - 26.57 - public void setUsername(String username) { 26.58 - this.username = username; 26.59 - } 26.60 - 26.61 - public Optional<String> getGivenname() { 26.62 - return givenname; 26.63 - } 26.64 - 26.65 - public void setGivenname(Optional<String> givenname) { 26.66 - this.givenname = givenname; 26.67 - } 26.68 - 26.69 - public Optional<String> getLastname() { 26.70 - return lastname; 26.71 - } 26.72 - 26.73 - public void setLastname(Optional<String> lastname) { 26.74 - this.lastname = lastname; 26.75 - } 26.76 - 26.77 - @Override 26.78 - public int hashCode() { 26.79 - int hash = 3; 26.80 - hash = 41 * hash + this.userID; 26.81 - return hash; 26.82 - } 26.83 - 26.84 - @Override 26.85 - public boolean equals(Object obj) { 26.86 - if (this == obj) { 26.87 - return true; 26.88 - } 26.89 - if (obj == null || getClass() != obj.getClass()) { 26.90 - return false; 26.91 - } else { 26.92 - return this.userID == ((User) obj).userID; 26.93 - } 26.94 - } 26.95 -}
27.1 --- a/src/java/de/uapcore/lightpit/entities/UserDao.java Sun Apr 08 16:51:15 2018 +0200 27.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 27.3 @@ -1,77 +0,0 @@ 27.4 -/* 27.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 27.6 - * 27.7 - * Copyright 2018 Mike Becker. All rights reserved. 27.8 - * 27.9 - * Redistribution and use in source and binary forms, with or without 27.10 - * modification, are permitted provided that the following conditions are met: 27.11 - * 27.12 - * 1. Redistributions of source code must retain the above copyright 27.13 - * notice, this list of conditions and the following disclaimer. 27.14 - * 27.15 - * 2. Redistributions in binary form must reproduce the above copyright 27.16 - * notice, this list of conditions and the following disclaimer in the 27.17 - * documentation and/or other materials provided with the distribution. 27.18 - * 27.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 27.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27.29 - * POSSIBILITY OF SUCH DAMAGE. 27.30 - * 27.31 - */ 27.32 -package de.uapcore.lightpit.entities; 27.33 - 27.34 -import java.sql.Connection; 27.35 -import java.sql.ResultSet; 27.36 -import java.sql.SQLException; 27.37 -import java.sql.Statement; 27.38 -import java.util.ArrayList; 27.39 -import java.util.List; 27.40 -import java.util.Optional; 27.41 - 27.42 -public abstract class UserDao { 27.43 - 27.44 - /** 27.45 - * Maps SQL columns to POJO fields. 27.46 - * @param result the database result set 27.47 - * @param user the POJO 27.48 - * @throws SQLException 27.49 - */ 27.50 - protected void mapColumns(ResultSet result, User user) throws SQLException { 27.51 - user.setUserID(result.getInt("userid")); 27.52 - user.setUsername(result.getString("username")); 27.53 - user.setGivenname(Optional.ofNullable(result.getString("givenname"))); 27.54 - user.setLastname(Optional.ofNullable(result.getString("lastname"))); 27.55 - } 27.56 - 27.57 - /** 27.58 - * Returns a list of all users ordered by their username. 27.59 - * 27.60 - * Does not return reserved system users with negative user IDs. 27.61 - * 27.62 - * @param conn the connection to use 27.63 - * @return a list of all users 27.64 - * @throws SQLException 27.65 - */ 27.66 - public List<User> listAll(Connection conn) throws SQLException { 27.67 - List<User> list = new ArrayList<>(); 27.68 - try ( 27.69 - Statement stmt = conn.createStatement(); 27.70 - ResultSet result = stmt.executeQuery( 27.71 - "SELECT * FROM lpitcore_user WHERE userid >= 0 ORDER BY username")) { 27.72 - while (result.next()) { 27.73 - final User user = new User(); 27.74 - mapColumns(result, user); 27.75 - list.add(user); 27.76 - } 27.77 - } 27.78 - return list; 27.79 - } 27.80 -}
28.1 --- a/src/java/de/uapcore/lightpit/modules/ErrorModule.java Sun Apr 08 16:51:15 2018 +0200 28.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 28.3 @@ -1,80 +0,0 @@ 28.4 -/* 28.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 28.6 - * 28.7 - * Copyright 2018 Mike Becker. All rights reserved. 28.8 - * 28.9 - * Redistribution and use in source and binary forms, with or without 28.10 - * modification, are permitted provided that the following conditions are met: 28.11 - * 28.12 - * 1. Redistributions of source code must retain the above copyright 28.13 - * notice, this list of conditions and the following disclaimer. 28.14 - * 28.15 - * 2. Redistributions in binary form must reproduce the above copyright 28.16 - * notice, this list of conditions and the following disclaimer in the 28.17 - * documentation and/or other materials provided with the distribution. 28.18 - * 28.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 28.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 28.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.29 - * POSSIBILITY OF SUCH DAMAGE. 28.30 - * 28.31 - */ 28.32 -package de.uapcore.lightpit.modules; 28.33 - 28.34 -import de.uapcore.lightpit.LightPITModule; 28.35 -import de.uapcore.lightpit.AbstractLightPITServlet; 28.36 -import de.uapcore.lightpit.HttpMethod; 28.37 -import de.uapcore.lightpit.RequestMapping; 28.38 -import de.uapcore.lightpit.ResponseType; 28.39 -import javax.servlet.annotation.WebServlet; 28.40 -import javax.servlet.http.HttpServletRequest; 28.41 -import javax.servlet.http.HttpServletResponse; 28.42 - 28.43 -/** 28.44 - * Entry point for the application. 28.45 - */ 28.46 -@LightPITModule( 28.47 - bundleBaseName = "de.uapcore.lightpit.resources.localization.error", 28.48 - modulePath = "error", 28.49 - titleKey = "title", 28.50 - systemModule = true 28.51 -) 28.52 -@WebServlet( 28.53 - name = "ErrorModule", 28.54 - urlPatterns = "/error/*" 28.55 -) 28.56 -public final class ErrorModule extends AbstractLightPITServlet { 28.57 - 28.58 - public static final String REQ_ATTR_ERROR_CODE = "errorCode"; 28.59 - 28.60 - private ResponseType handle(HttpServletRequest req, HttpServletResponse resp, int sc) { 28.61 - 28.62 - req.setAttribute(REQ_ATTR_ERROR_CODE, sc); 28.63 - setStylesheet(req, "error"); 28.64 - setDynamicFragment(req, "error"); 28.65 - 28.66 - return ResponseType.HTML_FULL; 28.67 - } 28.68 - 28.69 - @RequestMapping(requestPath = "404", method = HttpMethod.GET) 28.70 - public ResponseType handle404(HttpServletRequest req, HttpServletResponse resp) { 28.71 - return handle(req, resp, 404); 28.72 - } 28.73 - 28.74 - @RequestMapping(requestPath = "403", method = HttpMethod.GET) 28.75 - public ResponseType handle403(HttpServletRequest req, HttpServletResponse resp) { 28.76 - return handle(req, resp, 403); 28.77 - } 28.78 - 28.79 - @RequestMapping(requestPath = "500", method = HttpMethod.GET) 28.80 - public ResponseType handle500(HttpServletRequest req, HttpServletResponse resp) { 28.81 - return handle(req, resp, 500); 28.82 - } 28.83 -}
29.1 --- a/src/java/de/uapcore/lightpit/modules/HomeModule.java Sun Apr 08 16:51:15 2018 +0200 29.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 29.3 @@ -1,58 +0,0 @@ 29.4 -/* 29.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 29.6 - * 29.7 - * Copyright 2018 Mike Becker. All rights reserved. 29.8 - * 29.9 - * Redistribution and use in source and binary forms, with or without 29.10 - * modification, are permitted provided that the following conditions are met: 29.11 - * 29.12 - * 1. Redistributions of source code must retain the above copyright 29.13 - * notice, this list of conditions and the following disclaimer. 29.14 - * 29.15 - * 2. Redistributions in binary form must reproduce the above copyright 29.16 - * notice, this list of conditions and the following disclaimer in the 29.17 - * documentation and/or other materials provided with the distribution. 29.18 - * 29.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 29.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 29.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29.29 - * POSSIBILITY OF SUCH DAMAGE. 29.30 - * 29.31 - */ 29.32 -package de.uapcore.lightpit.modules; 29.33 - 29.34 -import de.uapcore.lightpit.LightPITModule; 29.35 -import de.uapcore.lightpit.AbstractLightPITServlet; 29.36 -import de.uapcore.lightpit.HttpMethod; 29.37 -import de.uapcore.lightpit.RequestMapping; 29.38 -import de.uapcore.lightpit.ResponseType; 29.39 -import javax.servlet.annotation.WebServlet; 29.40 -import javax.servlet.http.HttpServletRequest; 29.41 -import javax.servlet.http.HttpServletResponse; 29.42 - 29.43 -/** 29.44 - * Entry point for the application. 29.45 - */ 29.46 -@LightPITModule( 29.47 - bundleBaseName = "de.uapcore.lightpit.resources.localization.home", 29.48 - modulePath = "home" 29.49 -) 29.50 -@WebServlet( 29.51 - name = "HomeModule", 29.52 - urlPatterns = "/home/*" 29.53 -) 29.54 -public final class HomeModule extends AbstractLightPITServlet { 29.55 - 29.56 - @RequestMapping(method = HttpMethod.GET) 29.57 - public ResponseType handle(HttpServletRequest req, HttpServletResponse resp) { 29.58 - 29.59 - return ResponseType.HTML_FULL; 29.60 - } 29.61 -}
30.1 --- a/src/java/de/uapcore/lightpit/modules/LanguageModule.java Sun Apr 08 16:51:15 2018 +0200 30.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 30.3 @@ -1,118 +0,0 @@ 30.4 -/* 30.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 30.6 - * 30.7 - * Copyright 2018 Mike Becker. All rights reserved. 30.8 - * 30.9 - * Redistribution and use in source and binary forms, with or without 30.10 - * modification, are permitted provided that the following conditions are met: 30.11 - * 30.12 - * 1. Redistributions of source code must retain the above copyright 30.13 - * notice, this list of conditions and the following disclaimer. 30.14 - * 30.15 - * 2. Redistributions in binary form must reproduce the above copyright 30.16 - * notice, this list of conditions and the following disclaimer in the 30.17 - * documentation and/or other materials provided with the distribution. 30.18 - * 30.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 30.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 30.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30.29 - * POSSIBILITY OF SUCH DAMAGE. 30.30 - * 30.31 - */ 30.32 -package de.uapcore.lightpit.modules; 30.33 - 30.34 -import de.uapcore.lightpit.LightPITModule; 30.35 -import de.uapcore.lightpit.AbstractLightPITServlet; 30.36 -import de.uapcore.lightpit.Constants; 30.37 -import de.uapcore.lightpit.Functions; 30.38 -import de.uapcore.lightpit.HttpMethod; 30.39 -import javax.servlet.annotation.WebServlet; 30.40 -import javax.servlet.http.HttpServletRequest; 30.41 -import javax.servlet.http.HttpServletResponse; 30.42 -import de.uapcore.lightpit.RequestMapping; 30.43 -import de.uapcore.lightpit.ResponseType; 30.44 -import java.util.ArrayList; 30.45 -import java.util.IllformedLocaleException; 30.46 -import java.util.List; 30.47 -import java.util.Locale; 30.48 -import java.util.Optional; 30.49 -import javax.servlet.ServletException; 30.50 -import org.slf4j.Logger; 30.51 -import org.slf4j.LoggerFactory; 30.52 - 30.53 - 30.54 -@LightPITModule( 30.55 - bundleBaseName = "de.uapcore.lightpit.resources.localization.language", 30.56 - modulePath = "language" 30.57 -) 30.58 -@WebServlet( 30.59 - name = "LanguageModule", 30.60 - urlPatterns = "/language/*" 30.61 -) 30.62 -public final class LanguageModule extends AbstractLightPITServlet { 30.63 - 30.64 - private static final Logger LOG = LoggerFactory.getLogger(LanguageModule.class); 30.65 - 30.66 - private final List<Locale> languages = new ArrayList<>(); 30.67 - 30.68 - @Override 30.69 - public void init() throws ServletException { 30.70 - super.init(); 30.71 - 30.72 - Optional<String[]> langs = Functions.availableLanguages(getServletContext()); 30.73 - if (langs.isPresent()) { 30.74 - for (String lang : langs.get()) { 30.75 - try { 30.76 - Locale locale = Locale.forLanguageTag(lang); 30.77 - if (locale.getLanguage().isEmpty()) { 30.78 - throw new IllformedLocaleException(); 30.79 - } 30.80 - languages.add(locale); 30.81 - } catch (IllformedLocaleException ex) { 30.82 - LOG.warn("Specified lanaguge {} in context parameter cannot be mapped to an existing locale - skipping.", lang); 30.83 - } 30.84 - } 30.85 - 30.86 - } else { 30.87 - languages.add(Locale.ENGLISH); 30.88 - LOG.warn("Context parameter 'available-languges' not found. Only english will be available."); 30.89 - } 30.90 - } 30.91 - 30.92 - @Override 30.93 - public void destroy() { 30.94 - super.destroy(); 30.95 - languages.clear(); 30.96 - } 30.97 - 30.98 - @RequestMapping(method = HttpMethod.GET) 30.99 - public ResponseType handle(HttpServletRequest req, HttpServletResponse resp) { 30.100 - 30.101 - req.setAttribute("languages", languages); 30.102 - req.setAttribute("browserLanguage", req.getLocale()); 30.103 - 30.104 - setStylesheet(req, "language"); 30.105 - setDynamicFragment(req, "language"); 30.106 - return ResponseType.HTML_FULL; 30.107 - } 30.108 - 30.109 - @RequestMapping(method = HttpMethod.POST) 30.110 - public ResponseType switchLanguage(HttpServletRequest req, HttpServletResponse resp) { 30.111 - 30.112 - Optional<Locale> chosenLanguage = Optional.ofNullable(req.getParameter("language")) 30.113 - .map(Locale::forLanguageTag) 30.114 - .filter((l) -> !l.getLanguage().isEmpty()); 30.115 - 30.116 - chosenLanguage.ifPresent((l) -> req.getSession().setAttribute(Constants.SESSION_ATTR_LANGUAGE, l)); 30.117 - chosenLanguage.ifPresent(resp::setLocale); 30.118 - 30.119 - return handle(req, resp); 30.120 - } 30.121 -}
31.1 --- a/src/java/de/uapcore/lightpit/modules/ModuleManagerModule.java Sun Apr 08 16:51:15 2018 +0200 31.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 31.3 @@ -1,94 +0,0 @@ 31.4 -/* 31.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 31.6 - * 31.7 - * Copyright 2018 Mike Becker. All rights reserved. 31.8 - * 31.9 - * Redistribution and use in source and binary forms, with or without 31.10 - * modification, are permitted provided that the following conditions are met: 31.11 - * 31.12 - * 1. Redistributions of source code must retain the above copyright 31.13 - * notice, this list of conditions and the following disclaimer. 31.14 - * 31.15 - * 2. Redistributions in binary form must reproduce the above copyright 31.16 - * notice, this list of conditions and the following disclaimer in the 31.17 - * documentation and/or other materials provided with the distribution. 31.18 - * 31.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 31.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 31.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 31.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31.29 - * POSSIBILITY OF SUCH DAMAGE. 31.30 - * 31.31 - */ 31.32 -package de.uapcore.lightpit.modules; 31.33 - 31.34 -import de.uapcore.lightpit.LightPITModule; 31.35 -import de.uapcore.lightpit.AbstractLightPITServlet; 31.36 -import de.uapcore.lightpit.HttpMethod; 31.37 -import de.uapcore.lightpit.LightPITModule.ELProxy; 31.38 -import de.uapcore.lightpit.RequestMapping; 31.39 -import de.uapcore.lightpit.ResponseType; 31.40 -import de.uapcore.lightpit.entities.CoreDAOFactory; 31.41 -import de.uapcore.lightpit.entities.Module; 31.42 -import java.io.IOException; 31.43 -import java.sql.Connection; 31.44 -import java.sql.SQLException; 31.45 -import java.util.List; 31.46 -import java.util.Map; 31.47 -import java.util.Optional; 31.48 -import javax.servlet.annotation.WebServlet; 31.49 -import javax.servlet.http.HttpServletRequest; 31.50 -import javax.servlet.http.HttpServletResponse; 31.51 -import javax.sql.DataSource; 31.52 -import org.slf4j.Logger; 31.53 -import org.slf4j.LoggerFactory; 31.54 - 31.55 -/** 31.56 - * Entry point for the application. 31.57 - */ 31.58 -@LightPITModule( 31.59 - bundleBaseName = "de.uapcore.lightpit.resources.localization.modmgmt", 31.60 - modulePath = "modmgmt" 31.61 -) 31.62 -@WebServlet( 31.63 - name = "ModuleManagerModule", 31.64 - urlPatterns = "/modmgmt/*" 31.65 -) 31.66 -public final class ModuleManagerModule extends AbstractLightPITServlet { 31.67 - 31.68 - private static final Logger LOG = LoggerFactory.getLogger(ModuleManagerModule.class); 31.69 - 31.70 - private static final String REQ_ATTR_MODULES = "modules"; 31.71 - 31.72 - 31.73 - @RequestMapping(method = HttpMethod.GET) 31.74 - public ResponseType handle(HttpServletRequest req, HttpServletResponse resp) throws IOException { 31.75 - 31.76 - Optional<DataSource> ds = getDatabaseFacade().getDataSource(); 31.77 - if (ds.isPresent()) { 31.78 - try (Connection conn = ds.get().getConnection()) { 31.79 - final List<Module> modules = CoreDAOFactory.getModuleDao(getDatabaseFacade().getSQLDialect()).listAll(conn); 31.80 - 31.81 - final Map<String, LightPITModule> registeredModules = getModuleManager().getRegisteredModules(); 31.82 - modules.forEach((mod) -> mod.setAnnotatedInfos(ELProxy.convert(registeredModules.get(mod.getClassname())))); 31.83 - 31.84 - req.setAttribute(REQ_ATTR_MODULES, modules); 31.85 - setDynamicFragment(req, "modules"); 31.86 - return ResponseType.HTML_FULL; 31.87 - } catch (SQLException ex) { 31.88 - LOG.error("Unexpected SQL Exception", ex); 31.89 - resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 31.90 - return ResponseType.NONE; 31.91 - } 31.92 - } else { 31.93 - resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 31.94 - return ResponseType.NONE; 31.95 - } 31.96 - } 31.97 -}
32.1 --- a/src/java/de/uapcore/lightpit/modules/VersionsModule.java Sun Apr 08 16:51:15 2018 +0200 32.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 32.3 @@ -1,55 +0,0 @@ 32.4 -/* 32.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 32.6 - * 32.7 - * Copyright 2018 Mike Becker. All rights reserved. 32.8 - * 32.9 - * Redistribution and use in source and binary forms, with or without 32.10 - * modification, are permitted provided that the following conditions are met: 32.11 - * 32.12 - * 1. Redistributions of source code must retain the above copyright 32.13 - * notice, this list of conditions and the following disclaimer. 32.14 - * 32.15 - * 2. Redistributions in binary form must reproduce the above copyright 32.16 - * notice, this list of conditions and the following disclaimer in the 32.17 - * documentation and/or other materials provided with the distribution. 32.18 - * 32.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 32.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 32.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 32.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 32.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32.29 - * POSSIBILITY OF SUCH DAMAGE. 32.30 - * 32.31 - */ 32.32 -package de.uapcore.lightpit.modules; 32.33 - 32.34 -import de.uapcore.lightpit.LightPITModule; 32.35 -import de.uapcore.lightpit.AbstractLightPITServlet; 32.36 -import de.uapcore.lightpit.HttpMethod; 32.37 -import de.uapcore.lightpit.RequestMapping; 32.38 -import de.uapcore.lightpit.ResponseType; 32.39 -import javax.servlet.annotation.WebServlet; 32.40 -import javax.servlet.http.HttpServletRequest; 32.41 -import javax.servlet.http.HttpServletResponse; 32.42 - 32.43 - 32.44 -@LightPITModule( 32.45 - bundleBaseName = "de.uapcore.lightpit.resources.localization.versions", 32.46 - modulePath = "versions" 32.47 -) 32.48 -@WebServlet( 32.49 - name = "VersionsModule", 32.50 - urlPatterns = "/versions/*" 32.51 -) 32.52 -public final class VersionsModule extends AbstractLightPITServlet { 32.53 - @RequestMapping(method = HttpMethod.GET) 32.54 - public ResponseType handle(HttpServletRequest req, HttpServletResponse resp) { 32.55 - 32.56 - return ResponseType.HTML_FULL; 32.57 - } 32.58 -}
33.1 --- a/src/java/de/uapcore/lightpit/resources/localization/error.properties Sun Apr 08 16:51:15 2018 +0200 33.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 33.3 @@ -1,35 +0,0 @@ 33.4 -# Copyright 2018 Mike Becker. All rights reserved. 33.5 -# 33.6 -# Redistribution and use in source and binary forms, with or without 33.7 -# modification, are permitted provided that the following conditions are met: 33.8 -# 33.9 -# 1. Redistributions of source code must retain the above copyright 33.10 -# notice, this list of conditions and the following disclaimer. 33.11 -# 33.12 -# 2. Redistributions in binary form must reproduce the above copyright 33.13 -# notice, this list of conditions and the following disclaimer in the 33.14 -# documentation and/or other materials provided with the distribution. 33.15 -# 33.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 33.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 33.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 33.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 33.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 33.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33.26 - 33.27 -title = Error 33.28 - 33.29 -h1 = The requested page cannot be displayed. 33.30 -errorCode = Code 33.31 - 33.32 -errorMessage = Message 33.33 -errorMessage.404 = Page not found 33.34 -errorMessage.403 = Access denied 33.35 -errorMessage.500 = Internal error 33.36 - 33.37 -errorTimestamp = Timestamp 33.38 -errorExceptionText = Internal Exception
34.1 --- a/src/java/de/uapcore/lightpit/resources/localization/error_de.properties Sun Apr 08 16:51:15 2018 +0200 34.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 34.3 @@ -1,35 +0,0 @@ 34.4 -# Copyright 2018 Mike Becker. All rights reserved. 34.5 -# 34.6 -# Redistribution and use in source and binary forms, with or without 34.7 -# modification, are permitted provided that the following conditions are met: 34.8 -# 34.9 -# 1. Redistributions of source code must retain the above copyright 34.10 -# notice, this list of conditions and the following disclaimer. 34.11 -# 34.12 -# 2. Redistributions in binary form must reproduce the above copyright 34.13 -# notice, this list of conditions and the following disclaimer in the 34.14 -# documentation and/or other materials provided with the distribution. 34.15 -# 34.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 34.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 34.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 34.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 34.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 34.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 34.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 34.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 34.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34.26 - 34.27 -title = Fehler 34.28 - 34.29 -h1 = Die angeforderte Seite kann nicht angezeigt werden. 34.30 -errorCode = Fehlercode 34.31 - 34.32 -errorMessage = Nachricht 34.33 -errorMessage.404 = Seite nicht gefunden 34.34 -errorMessage.403 = Zugriff verboten 34.35 -errorMessage.500 = Interner Fehler 34.36 - 34.37 -errorTimestamp = Zeitstempel 34.38 -errorExceptionText = Interne Ausnahme
35.1 --- a/src/java/de/uapcore/lightpit/resources/localization/home.properties Sun Apr 08 16:51:15 2018 +0200 35.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 35.3 @@ -1,26 +0,0 @@ 35.4 -# Copyright 2018 Mike Becker. All rights reserved. 35.5 -# 35.6 -# Redistribution and use in source and binary forms, with or without 35.7 -# modification, are permitted provided that the following conditions are met: 35.8 -# 35.9 -# 1. Redistributions of source code must retain the above copyright 35.10 -# notice, this list of conditions and the following disclaimer. 35.11 -# 35.12 -# 2. Redistributions in binary form must reproduce the above copyright 35.13 -# notice, this list of conditions and the following disclaimer in the 35.14 -# documentation and/or other materials provided with the distribution. 35.15 -# 35.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 35.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 35.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 35.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 35.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 35.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 35.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 35.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35.26 - 35.27 -name = Home Page 35.28 -description = The default page that is displayed when visiting the site. 35.29 -menuLabel = Home
36.1 --- a/src/java/de/uapcore/lightpit/resources/localization/home_de.properties Sun Apr 08 16:51:15 2018 +0200 36.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 36.3 @@ -1,26 +0,0 @@ 36.4 -# Copyright 2018 Mike Becker. All rights reserved. 36.5 -# 36.6 -# Redistribution and use in source and binary forms, with or without 36.7 -# modification, are permitted provided that the following conditions are met: 36.8 -# 36.9 -# 1. Redistributions of source code must retain the above copyright 36.10 -# notice, this list of conditions and the following disclaimer. 36.11 -# 36.12 -# 2. Redistributions in binary form must reproduce the above copyright 36.13 -# notice, this list of conditions and the following disclaimer in the 36.14 -# documentation and/or other materials provided with the distribution. 36.15 -# 36.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 36.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 36.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 36.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 36.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 36.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 36.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 36.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36.26 - 36.27 -name = Startseite 36.28 -description = Die Seite, die dem Benutzer standardm\u00e4\u00dfig beim Besuch angezeigt wird. 36.29 -menuLabel = Startseite
37.1 --- a/src/java/de/uapcore/lightpit/resources/localization/language.properties Sun Apr 08 16:51:15 2018 +0200 37.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 37.3 @@ -1,30 +0,0 @@ 37.4 -# Copyright 2018 Mike Becker. All rights reserved. 37.5 -# 37.6 -# Redistribution and use in source and binary forms, with or without 37.7 -# modification, are permitted provided that the following conditions are met: 37.8 -# 37.9 -# 1. Redistributions of source code must retain the above copyright 37.10 -# notice, this list of conditions and the following disclaimer. 37.11 -# 37.12 -# 2. Redistributions in binary form must reproduce the above copyright 37.13 -# notice, this list of conditions and the following disclaimer in the 37.14 -# documentation and/or other materials provided with the distribution. 37.15 -# 37.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 37.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 37.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 37.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 37.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 37.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 37.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 37.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37.26 - 37.27 -name = Language Selector 37.28 -description = Where the user can choose his / her language setting. 37.29 -menuLabel = Languages 37.30 - 37.31 -submit = Switch language 37.32 -browserLanguage = Browser language 37.33 -browserLanguageNotAvailable = Browser language not available.
38.1 --- a/src/java/de/uapcore/lightpit/resources/localization/language_de.properties Sun Apr 08 16:51:15 2018 +0200 38.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 38.3 @@ -1,31 +0,0 @@ 38.4 -# Copyright 2018 Mike Becker. All rights reserved. 38.5 -# 38.6 -# Redistribution and use in source and binary forms, with or without 38.7 -# modification, are permitted provided that the following conditions are met: 38.8 -# 38.9 -# 1. Redistributions of source code must retain the above copyright 38.10 -# notice, this list of conditions and the following disclaimer. 38.11 -# 38.12 -# 2. Redistributions in binary form must reproduce the above copyright 38.13 -# notice, this list of conditions and the following disclaimer in the 38.14 -# documentation and/or other materials provided with the distribution. 38.15 -# 38.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 38.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 38.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 38.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 38.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 38.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 38.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 38.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38.26 - 38.27 -name = Sprachauswahl 38.28 -description = Hier kann der Benutzer die Sprache f\u00fcr die Website ausw\u00e4hlen. 38.29 - 38.30 -menuLabel = Sprache 38.31 - 38.32 -submit = Sprache ausw\u00e4hlen 38.33 -browserLanguage = Browsersprache 38.34 -browserLanguageNotAvailable = Browsersprache nicht verf\u00fcgbar.
39.1 --- a/src/java/de/uapcore/lightpit/resources/localization/modmgmt.properties Sun Apr 08 16:51:15 2018 +0200 39.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 39.3 @@ -1,36 +0,0 @@ 39.4 -# Copyright 2018 Mike Becker. All rights reserved. 39.5 -# 39.6 -# Redistribution and use in source and binary forms, with or without 39.7 -# modification, are permitted provided that the following conditions are met: 39.8 -# 39.9 -# 1. Redistributions of source code must retain the above copyright 39.10 -# notice, this list of conditions and the following disclaimer. 39.11 -# 39.12 -# 2. Redistributions in binary form must reproduce the above copyright 39.13 -# notice, this list of conditions and the following disclaimer in the 39.14 -# documentation and/or other materials provided with the distribution. 39.15 -# 39.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 39.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 39.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 39.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 39.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 39.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 39.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 39.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 39.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39.26 - 39.27 -name = Module Management 39.28 -description = Configure the visible LightPIT modules and the required access powers. 39.29 -menuLabel = Modules 39.30 - 39.31 -section.modlist.title = List of Modules 39.32 - 39.33 -caption.module = Module 39.34 -caption.path = Path 39.35 -caption.desc = Description 39.36 -caption.active = Active 39.37 -caption.class = Class 39.38 -caption.bundle = Resource Bundle 39.39 -
40.1 --- a/src/java/de/uapcore/lightpit/resources/localization/modmgmt_de.properties Sun Apr 08 16:51:15 2018 +0200 40.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 40.3 @@ -1,35 +0,0 @@ 40.4 -# Copyright 2018 Mike Becker. All rights reserved. 40.5 -# 40.6 -# Redistribution and use in source and binary forms, with or without 40.7 -# modification, are permitted provided that the following conditions are met: 40.8 -# 40.9 -# 1. Redistributions of source code must retain the above copyright 40.10 -# notice, this list of conditions and the following disclaimer. 40.11 -# 40.12 -# 2. Redistributions in binary form must reproduce the above copyright 40.13 -# notice, this list of conditions and the following disclaimer in the 40.14 -# documentation and/or other materials provided with the distribution. 40.15 -# 40.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 40.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 40.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 40.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 40.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 40.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 40.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 40.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 40.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 40.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40.26 - 40.27 -name = Modulverwaltung 40.28 -description = Konfiguration der sichtbaren LightPIT Module und deren Zugriffsrechte. 40.29 -menuLabel = Module 40.30 - 40.31 -section.modlist.title = Liste der Module 40.32 - 40.33 -caption.module = Modul 40.34 -caption.path = Pfad 40.35 -caption.desc = Beschreibung 40.36 -caption.active = Aktiv 40.37 -caption.class = Klasse 40.38 -caption.bundle = Ressourcen-Datei
41.1 --- a/src/java/de/uapcore/lightpit/resources/localization/versions.properties Sun Apr 08 16:51:15 2018 +0200 41.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 41.3 @@ -1,26 +0,0 @@ 41.4 -# Copyright 2018 Mike Becker. All rights reserved. 41.5 -# 41.6 -# Redistribution and use in source and binary forms, with or without 41.7 -# modification, are permitted provided that the following conditions are met: 41.8 -# 41.9 -# 1. Redistributions of source code must retain the above copyright 41.10 -# notice, this list of conditions and the following disclaimer. 41.11 -# 41.12 -# 2. Redistributions in binary form must reproduce the above copyright 41.13 -# notice, this list of conditions and the following disclaimer in the 41.14 -# documentation and/or other materials provided with the distribution. 41.15 -# 41.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 41.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 41.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 41.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 41.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 41.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 41.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 41.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41.26 - 41.27 -name = Version Management 41.28 -description = Allows the configuration of versions and milestones within your project. 41.29 -menuLabel = Versions
42.1 --- a/src/java/de/uapcore/lightpit/resources/localization/versions_de.properties Sun Apr 08 16:51:15 2018 +0200 42.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 42.3 @@ -1,26 +0,0 @@ 42.4 -# Copyright 2018 Mike Becker. All rights reserved. 42.5 -# 42.6 -# Redistribution and use in source and binary forms, with or without 42.7 -# modification, are permitted provided that the following conditions are met: 42.8 -# 42.9 -# 1. Redistributions of source code must retain the above copyright 42.10 -# notice, this list of conditions and the following disclaimer. 42.11 -# 42.12 -# 2. Redistributions in binary form must reproduce the above copyright 42.13 -# notice, this list of conditions and the following disclaimer in the 42.14 -# documentation and/or other materials provided with the distribution. 42.15 -# 42.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 42.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 42.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 42.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 42.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 42.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 42.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 42.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 42.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42.26 - 42.27 -name = Versionsverwaltung 42.28 -description = Erlaubt die Konfiguration von Versionen und Meilensteinen im Projekt. 42.29 -menuLabel = Versionen
43.1 --- a/src/java/log4j2.properties Sun Apr 08 16:51:15 2018 +0200 43.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 43.3 @@ -1,36 +0,0 @@ 43.4 -# Copyright 2018 Mike Becker. All rights reserved. 43.5 -# 43.6 -# Redistribution and use in source and binary forms, with or without 43.7 -# modification, are permitted provided that the following conditions are met: 43.8 -# 43.9 -# 1. Redistributions of source code must retain the above copyright 43.10 -# notice, this list of conditions and the following disclaimer. 43.11 -# 43.12 -# 2. Redistributions in binary form must reproduce the above copyright 43.13 -# notice, this list of conditions and the following disclaimer in the 43.14 -# documentation and/or other materials provided with the distribution. 43.15 -# 43.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 43.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 43.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 43.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 43.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 43.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 43.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 43.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 43.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43.26 - 43.27 - 43.28 -status = warn 43.29 -dest = err 43.30 -name = PropertiesConfig 43.31 - 43.32 -appender.console.type = Console 43.33 -appender.console.name = STDOUT 43.34 -appender.console.layout.type = PatternLayout 43.35 -appender.console.layout.pattern = %d{ISO8601} [%highlight{%p}] %c{1}: %m %n 43.36 - 43.37 -rootLogger.appenderRef.stdout.ref = STDOUT 43.38 - 43.39 -rootLogger.level = debug
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 44.2 +++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java Sat May 09 14:26:31 2020 +0200 44.3 @@ -0,0 +1,296 @@ 44.4 +/* 44.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 44.6 + * 44.7 + * Copyright 2018 Mike Becker. All rights reserved. 44.8 + * 44.9 + * Redistribution and use in source and binary forms, with or without 44.10 + * modification, are permitted provided that the following conditions are met: 44.11 + * 44.12 + * 1. Redistributions of source code must retain the above copyright 44.13 + * notice, this list of conditions and the following disclaimer. 44.14 + * 44.15 + * 2. Redistributions in binary form must reproduce the above copyright 44.16 + * notice, this list of conditions and the following disclaimer in the 44.17 + * documentation and/or other materials provided with the distribution. 44.18 + * 44.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 44.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 44.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 44.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 44.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 44.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 44.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 44.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 44.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 44.29 + * POSSIBILITY OF SUCH DAMAGE. 44.30 + * 44.31 + */ 44.32 +package de.uapcore.lightpit; 44.33 + 44.34 +import java.io.IOException; 44.35 +import java.lang.reflect.Method; 44.36 +import java.lang.reflect.Modifier; 44.37 +import java.util.Arrays; 44.38 +import java.util.HashMap; 44.39 +import java.util.List; 44.40 +import java.util.Locale; 44.41 +import java.util.Map; 44.42 +import java.util.Optional; 44.43 +import javax.servlet.ServletException; 44.44 +import javax.servlet.http.HttpServlet; 44.45 +import javax.servlet.http.HttpServletRequest; 44.46 +import javax.servlet.http.HttpServletResponse; 44.47 +import javax.servlet.http.HttpSession; 44.48 +import org.slf4j.Logger; 44.49 +import org.slf4j.LoggerFactory; 44.50 + 44.51 +/** 44.52 + * A special implementation of a HTTPServlet which is focused on implementing 44.53 + * the necessary functionality for {@link LightPITModule}s. 44.54 + */ 44.55 +public abstract class AbstractLightPITServlet extends HttpServlet { 44.56 + 44.57 + private static final Logger LOG = LoggerFactory.getLogger(AbstractLightPITServlet.class); 44.58 + 44.59 + private static final String HTML_FULL_DISPATCHER = Functions.jspPath("html_full"); 44.60 + 44.61 + /** 44.62 + * Store a reference to the annotation for quicker access. 44.63 + */ 44.64 + private Optional<LightPITModule> moduleInfo = Optional.empty(); 44.65 + 44.66 + /** 44.67 + * The EL proxy is necessary, because the EL resolver cannot handle annotation properties. 44.68 + */ 44.69 + private Optional<LightPITModule.ELProxy> moduleInfoELProxy = Optional.empty(); 44.70 + 44.71 + 44.72 + @FunctionalInterface 44.73 + private static interface HandlerMethod { 44.74 + ResponseType apply(HttpServletRequest t, HttpServletResponse u) throws IOException, ServletException; 44.75 + } 44.76 + 44.77 + /** 44.78 + * Invocation mapping gathered from the {@link RequestMapping} annotations. 44.79 + * 44.80 + * Paths in this map must always start with a leading slash, although 44.81 + * the specification in the annotation must not start with a leading slash. 44.82 + * 44.83 + * The reason for this is the different handling of empty paths in 44.84 + * {@link HttpServletRequest#getPathInfo()}. 44.85 + */ 44.86 + private final Map<HttpMethod, Map<String, HandlerMethod>> mappings = new HashMap<>(); 44.87 + 44.88 + /** 44.89 + * Gives implementing modules access to the {@link ModuleManager}. 44.90 + * @return the module manager 44.91 + */ 44.92 + protected final ModuleManager getModuleManager() { 44.93 + return (ModuleManager) getServletContext().getAttribute(ModuleManager.SC_ATTR_NAME); 44.94 + } 44.95 + 44.96 + /** 44.97 + * Gives implementing modules access to the {@link DatabaseFacade}. 44.98 + * @return the database facade 44.99 + */ 44.100 + protected final DatabaseFacade getDatabaseFacade() { 44.101 + return (DatabaseFacade) getServletContext().getAttribute(DatabaseFacade.SC_ATTR_NAME); 44.102 + } 44.103 + 44.104 + private ResponseType invokeMapping(Method method, HttpServletRequest req, HttpServletResponse resp) 44.105 + throws IOException, ServletException { 44.106 + try { 44.107 + LOG.trace("invoke {}#{}", method.getDeclaringClass().getName(), method.getName()); 44.108 + return (ResponseType) method.invoke(this, req, resp); 44.109 + } catch (ReflectiveOperationException | ClassCastException ex) { 44.110 + LOG.error(String.format("invocation of method %s failed", method.getName()), ex); 44.111 + resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 44.112 + return ResponseType.NONE; 44.113 + } 44.114 + } 44.115 + 44.116 + @Override 44.117 + public void init() throws ServletException { 44.118 + moduleInfo = Optional.ofNullable(this.getClass().getAnnotation(LightPITModule.class)); 44.119 + moduleInfoELProxy = moduleInfo.map(LightPITModule.ELProxy::convert); 44.120 + 44.121 + if (moduleInfo.isPresent()) { 44.122 + scanForRequestMappings(); 44.123 + } 44.124 + 44.125 + LOG.trace("{} initialized", getServletName()); 44.126 + } 44.127 + 44.128 + private void scanForRequestMappings() { 44.129 + try { 44.130 + Method[] methods = getClass().getDeclaredMethods(); 44.131 + for (Method method : methods) { 44.132 + Optional<RequestMapping> mapping = Optional.ofNullable(method.getAnnotation(RequestMapping.class)); 44.133 + if (mapping.isPresent()) { 44.134 + if (!Modifier.isPublic(method.getModifiers())) { 44.135 + LOG.warn("{} is annotated with {} but is not public", 44.136 + method.getName(), RequestMapping.class.getSimpleName() 44.137 + ); 44.138 + continue; 44.139 + } 44.140 + if (Modifier.isAbstract(method.getModifiers())) { 44.141 + LOG.warn("{} is annotated with {} but is abstract", 44.142 + method.getName(), RequestMapping.class.getSimpleName() 44.143 + ); 44.144 + continue; 44.145 + } 44.146 + if (!ResponseType.class.isAssignableFrom(method.getReturnType())) { 44.147 + LOG.warn("{} is annotated with {} but has the wrong return type - 'ResponseType' required", 44.148 + method.getName(), RequestMapping.class.getSimpleName() 44.149 + ); 44.150 + continue; 44.151 + } 44.152 + 44.153 + Class<?>[] params = method.getParameterTypes(); 44.154 + if (params.length == 2 44.155 + && HttpServletRequest.class.isAssignableFrom(params[0]) 44.156 + && HttpServletResponse.class.isAssignableFrom(params[1])) { 44.157 + 44.158 + final String requestPath = "/"+mapping.get().requestPath(); 44.159 + 44.160 + if (mappings.computeIfAbsent(mapping.get().method(), k -> new HashMap<>()). 44.161 + putIfAbsent(requestPath, 44.162 + (req, resp) -> invokeMapping(method, req, resp)) != null) { 44.163 + LOG.warn("{} {} has multiple mappings", 44.164 + mapping.get().method(), 44.165 + mapping.get().requestPath() 44.166 + ); 44.167 + } 44.168 + 44.169 + LOG.debug("{} {} maps to {}::{}", 44.170 + mapping.get().method(), 44.171 + requestPath, 44.172 + getClass().getSimpleName(), 44.173 + method.getName() 44.174 + ); 44.175 + } else { 44.176 + LOG.warn("{} is annotated with {} but has the wrong parameters - (HttpServletRequest,HttpServletResponse) required", 44.177 + method.getName(), RequestMapping.class.getSimpleName() 44.178 + ); 44.179 + } 44.180 + } 44.181 + } 44.182 + } catch (SecurityException ex) { 44.183 + LOG.error("Scan for request mappings on declared methods failed.", ex); 44.184 + } 44.185 + } 44.186 + 44.187 + @Override 44.188 + public void destroy() { 44.189 + mappings.clear(); 44.190 + LOG.trace("{} destroyed", getServletName()); 44.191 + } 44.192 + 44.193 + /** 44.194 + * Sets the name of the dynamic fragment. 44.195 + * 44.196 + * It is sufficient to specify the name without any extension. The extension 44.197 + * is added automatically if not specified. 44.198 + * 44.199 + * The fragment must be located in the dynamic fragments folder. 44.200 + * 44.201 + * @param req the servlet request object 44.202 + * @param fragmentName the name of the fragment 44.203 + * @see Constants#DYN_FRAGMENT_PATH_PREFIX 44.204 + */ 44.205 + public void setDynamicFragment(HttpServletRequest req, String fragmentName) { 44.206 + req.setAttribute(Constants.REQ_ATTR_FRAGMENT, Functions.dynFragmentPath(fragmentName)); 44.207 + } 44.208 + 44.209 + /** 44.210 + * Specifies the name of an additional stylesheet used by the module. 44.211 + * 44.212 + * Setting an additional stylesheet is optional, but quite common for HTML 44.213 + * output. 44.214 + * 44.215 + * It is sufficient to specify the name without any extension. The extension 44.216 + * is added automatically if not specified. 44.217 + * 44.218 + * @param req the servlet request object 44.219 + * @param stylesheet the name of the stylesheet 44.220 + */ 44.221 + public void setStylesheet(HttpServletRequest req, String stylesheet) { 44.222 + req.setAttribute(Constants.REQ_ATTR_STYLESHEET, Functions.enforceExt(stylesheet, ".css")); 44.223 + } 44.224 + 44.225 + private void forwardToFullView(HttpServletRequest req, HttpServletResponse resp) 44.226 + throws IOException, ServletException { 44.227 + 44.228 + req.setAttribute(Constants.REQ_ATTR_MENU, getModuleManager().getMainMenu(getDatabaseFacade())); 44.229 + req.getRequestDispatcher(HTML_FULL_DISPATCHER).forward(req, resp); 44.230 + } 44.231 + 44.232 + private Optional<HandlerMethod> findMapping(HttpMethod method, HttpServletRequest req) { 44.233 + return Optional.ofNullable(mappings.get(method)).map( 44.234 + (rm) -> rm.get(Optional.ofNullable(req.getPathInfo()).orElse("/")) 44.235 + ); 44.236 + } 44.237 + 44.238 + private void forwardAsSepcified(ResponseType type, HttpServletRequest req, HttpServletResponse resp) 44.239 + throws ServletException, IOException { 44.240 + switch (type) { 44.241 + case NONE: return; 44.242 + case HTML_FULL: 44.243 + forwardToFullView(req, resp); 44.244 + return; 44.245 + // TODO: implement remaining response types 44.246 + default: 44.247 + // this code should be unreachable 44.248 + LOG.error("ResponseType switch is not exhaustive - this is a bug!"); 44.249 + throw new UnsupportedOperationException(); 44.250 + } 44.251 + } 44.252 + 44.253 + private void doProcess(HttpMethod method, HttpServletRequest req, HttpServletResponse resp) 44.254 + throws ServletException, IOException { 44.255 + 44.256 + // Synchronize module information with database 44.257 + getModuleManager().syncWithDatabase(getDatabaseFacade()); 44.258 + 44.259 + // choose the requested language as session language (if available) or fall back to english, otherwise 44.260 + HttpSession session = req.getSession(); 44.261 + if (session.getAttribute(Constants.SESSION_ATTR_LANGUAGE) == null) { 44.262 + Optional<List<String>> availableLanguages = Functions.availableLanguages(getServletContext()).map(Arrays::asList); 44.263 + Optional<Locale> reqLocale = Optional.of(req.getLocale()); 44.264 + Locale sessionLocale = reqLocale.filter((rl) -> availableLanguages.map((al) -> al.contains(rl.getLanguage())).orElse(false)).orElse(Locale.ENGLISH); 44.265 + session.setAttribute(Constants.SESSION_ATTR_LANGUAGE, sessionLocale); 44.266 + LOG.debug("Settng language for new session {}: {}", session.getId(), sessionLocale.getDisplayLanguage()); 44.267 + } else { 44.268 + Locale sessionLocale = (Locale) session.getAttribute(Constants.SESSION_ATTR_LANGUAGE); 44.269 + resp.setLocale(sessionLocale); 44.270 + LOG.trace("Continuing session {} with language {}", session.getId(), sessionLocale); 44.271 + } 44.272 + 44.273 + // set some internal request attributes 44.274 + req.setAttribute(Constants.REQ_ATTR_PATH, Functions.fullPath(req)); 44.275 + req.setAttribute(Constants.REQ_ATTR_MODULE_CLASSNAME, this.getClass().getName()); 44.276 + moduleInfoELProxy.ifPresent((proxy) -> req.setAttribute(Constants.REQ_ATTR_MODULE_INFO, proxy)); 44.277 + 44.278 + 44.279 + // call the handler, if available, or send an HTTP 404 error 44.280 + Optional<HandlerMethod> mapping = findMapping(method, req); 44.281 + if (mapping.isPresent()) { 44.282 + forwardAsSepcified(mapping.get().apply(req, resp), req, resp); 44.283 + } else { 44.284 + resp.sendError(HttpServletResponse.SC_NOT_FOUND); 44.285 + } 44.286 + } 44.287 + 44.288 + @Override 44.289 + protected final void doGet(HttpServletRequest req, HttpServletResponse resp) 44.290 + throws ServletException, IOException { 44.291 + doProcess(HttpMethod.GET, req, resp); 44.292 + } 44.293 + 44.294 + @Override 44.295 + protected final void doPost(HttpServletRequest req, HttpServletResponse resp) 44.296 + throws ServletException, IOException { 44.297 + doProcess(HttpMethod.POST, req, resp); 44.298 + } 44.299 +}
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 45.2 +++ b/src/main/java/de/uapcore/lightpit/Constants.java Sat May 09 14:26:31 2020 +0200 45.3 @@ -0,0 +1,106 @@ 45.4 +/* 45.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 45.6 + * 45.7 + * Copyright 2018 Mike Becker. All rights reserved. 45.8 + * 45.9 + * Redistribution and use in source and binary forms, with or without 45.10 + * modification, are permitted provided that the following conditions are met: 45.11 + * 45.12 + * 1. Redistributions of source code must retain the above copyright 45.13 + * notice, this list of conditions and the following disclaimer. 45.14 + * 45.15 + * 2. Redistributions in binary form must reproduce the above copyright 45.16 + * notice, this list of conditions and the following disclaimer in the 45.17 + * documentation and/or other materials provided with the distribution. 45.18 + * 45.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 45.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 45.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 45.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 45.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 45.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 45.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 45.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 45.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 45.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 45.29 + * POSSIBILITY OF SUCH DAMAGE. 45.30 + * 45.31 + */ 45.32 +package de.uapcore.lightpit; 45.33 + 45.34 +import static de.uapcore.lightpit.Functions.fqn; 45.35 + 45.36 +/** 45.37 + * Contains all non-local scope constants used by the this application. 45.38 + * 45.39 + * Constants with (class) local scope are defined in their respective classes. 45.40 + */ 45.41 +public final class Constants { 45.42 + public static final String JSP_PATH_PREFIX = "/WEB-INF/jsp/"; 45.43 + 45.44 + public static final String JSPF_PATH_PREFIX = "/WEB-INF/jspf/"; 45.45 + 45.46 + public static final String DYN_FRAGMENT_PATH_PREFIX = "/WEB-INF/dynamic_fragments/"; 45.47 + 45.48 + 45.49 + /** 45.50 + * Name for the context parameter specifying the available languages. 45.51 + */ 45.52 + public static final String CTX_ATTR_LANGUAGES = "available-languages"; 45.53 + 45.54 + /** 45.55 + * Name for the context parameter optionally specifying the JNDI context; 45.56 + */ 45.57 + public static final String CTX_ATTR_JNDI_CONTEXT = "jndi-context"; 45.58 + 45.59 + /** 45.60 + * Name for the context parameter optionally specifying a database schema. 45.61 + */ 45.62 + public static final String CTX_ATTR_DB_SCHEMA = "db-schema"; 45.63 + 45.64 + /** 45.65 + * Name for the context parameter optionally specifying a database dialect. 45.66 + */ 45.67 + public static final String CTX_ATTR_DB_DIALECT = "db-dialect"; 45.68 + 45.69 + /** 45.70 + * Key for the request attribute containing the class name of the currently dispatching module. 45.71 + */ 45.72 + public static final String REQ_ATTR_MODULE_CLASSNAME = fqn(AbstractLightPITServlet.class, "moduleClassname"); 45.73 + 45.74 + /** 45.75 + * Key for the request attribute containing the {@link LightPITModule} information of the currently dispatching module. 45.76 + */ 45.77 + public static final String REQ_ATTR_MODULE_INFO = fqn(AbstractLightPITServlet.class, "moduleInfo"); 45.78 + 45.79 + /** 45.80 + * Key for the request attribute containing the menu list. 45.81 + */ 45.82 + public static final String REQ_ATTR_MENU = fqn(AbstractLightPITServlet.class, "mainMenu"); 45.83 + 45.84 + /** 45.85 + * Key for the request attribute containing the full path information (servlet path + path info). 45.86 + */ 45.87 + public static final String REQ_ATTR_PATH = fqn(AbstractLightPITServlet.class, "path"); 45.88 + 45.89 + /** 45.90 + * Key for the name of the fragment which should be rendered. 45.91 + */ 45.92 + public static final String REQ_ATTR_FRAGMENT = fqn(AbstractLightPITServlet.class, "fragment"); 45.93 + 45.94 + /** 45.95 + * Key for the name of the additional stylesheet used by a module. 45.96 + */ 45.97 + public static final String REQ_ATTR_STYLESHEET = fqn(AbstractLightPITServlet.class, "extraCss"); 45.98 + 45.99 + 45.100 + /** 45.101 + * Key for the current language selection within the session. 45.102 + */ 45.103 + public static final String SESSION_ATTR_LANGUAGE = fqn(AbstractLightPITServlet.class, "language"); 45.104 + 45.105 + /** 45.106 + * This class is not instantiatable. 45.107 + */ 45.108 + private Constants() {} 45.109 +}
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 46.2 +++ b/src/main/java/de/uapcore/lightpit/DatabaseFacade.java Sat May 09 14:26:31 2020 +0200 46.3 @@ -0,0 +1,178 @@ 46.4 +/* 46.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 46.6 + * 46.7 + * Copyright 2018 Mike Becker. All rights reserved. 46.8 + * 46.9 + * Redistribution and use in source and binary forms, with or without 46.10 + * modification, are permitted provided that the following conditions are met: 46.11 + * 46.12 + * 1. Redistributions of source code must retain the above copyright 46.13 + * notice, this list of conditions and the following disclaimer. 46.14 + * 46.15 + * 2. Redistributions in binary form must reproduce the above copyright 46.16 + * notice, this list of conditions and the following disclaimer in the 46.17 + * documentation and/or other materials provided with the distribution. 46.18 + * 46.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 46.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 46.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 46.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 46.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 46.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 46.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 46.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 46.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 46.29 + * POSSIBILITY OF SUCH DAMAGE. 46.30 + * 46.31 + */ 46.32 +package de.uapcore.lightpit; 46.33 + 46.34 +import java.sql.Connection; 46.35 +import java.sql.DatabaseMetaData; 46.36 +import java.sql.SQLException; 46.37 +import java.util.Optional; 46.38 +import javax.naming.Context; 46.39 +import javax.naming.InitialContext; 46.40 +import javax.naming.NamingException; 46.41 +import javax.servlet.ServletContext; 46.42 +import javax.servlet.ServletContextEvent; 46.43 +import javax.servlet.ServletContextListener; 46.44 +import javax.servlet.annotation.WebListener; 46.45 +import javax.sql.DataSource; 46.46 +import org.slf4j.Logger; 46.47 +import org.slf4j.LoggerFactory; 46.48 + 46.49 +/** 46.50 + * Provides access to different privilege layers within the database. 46.51 + */ 46.52 +@WebListener 46.53 +public final class DatabaseFacade implements ServletContextListener { 46.54 + 46.55 + private static final Logger LOG = LoggerFactory.getLogger(DatabaseFacade.class); 46.56 + 46.57 + /** 46.58 + * Timeout in seconds for the validation test. 46.59 + */ 46.60 + private static final int DB_TEST_TIMEOUT = 10; 46.61 + 46.62 + public static enum Dialect { 46.63 + Postgres; 46.64 + } 46.65 + 46.66 + /** 46.67 + * The database dialect to use. 46.68 + * 46.69 + * May be override by context parameter. 46.70 + * 46.71 + * @see Constants#CTX_ATTR_DB_DIALECT 46.72 + */ 46.73 + private Dialect dialect = Dialect.Postgres; 46.74 + 46.75 + /** 46.76 + * The default schema to test against when validating the connection. 46.77 + * 46.78 + * May be overridden by context parameter. 46.79 + * 46.80 + * @see Constants#CTX_ATTR_DB_SCHEMA 46.81 + */ 46.82 + private static final String DB_DEFAULT_SCHEMA = "lightpit"; 46.83 + 46.84 + /** 46.85 + * The attribute name in the Servlet context under which an instance of this class can be found. 46.86 + */ 46.87 + public static final String SC_ATTR_NAME = DatabaseFacade.class.getName(); 46.88 + private ServletContext sc; 46.89 + 46.90 + private static final String DS_JNDI_NAME = "jdbc/lightpit/app"; 46.91 + private Optional<DataSource> dataSource; 46.92 + 46.93 + /** 46.94 + * Returns the data source. 46.95 + * 46.96 + * The Optional returned should never be empty. However, if something goes 46.97 + * wrong during initialization, the data source might be absent. 46.98 + * Hence, users of this data source are forced to check the existence. 46.99 + * 46.100 + * @return a data source 46.101 + */ 46.102 + public Optional<DataSource> getDataSource() { 46.103 + return dataSource; 46.104 + } 46.105 + 46.106 + public Dialect getSQLDialect() { 46.107 + return dialect; 46.108 + } 46.109 + 46.110 + private static void checkConnection(DataSource ds, String testSchema, String errMsg) { 46.111 + try (Connection conn = ds.getConnection()) { 46.112 + if (!conn.isValid(DB_TEST_TIMEOUT)) { 46.113 + throw new SQLException("Validation check failed."); 46.114 + } 46.115 + if (conn.isReadOnly()) { 46.116 + throw new SQLException("Connection is read-only and thus unusable."); 46.117 + } 46.118 + if (!conn.getSchema().equals(testSchema)) { 46.119 + throw new SQLException(String.format("Connection is not configured to use the schema %s.", testSchema)); 46.120 + } 46.121 + DatabaseMetaData metaData = conn.getMetaData(); 46.122 + LOG.info("Connections as {} to {}/{} ready to go.", metaData.getUserName(), metaData.getURL(), conn.getSchema()); 46.123 + } catch (SQLException ex) { 46.124 + LOG.error(errMsg, ex); 46.125 + } 46.126 + } 46.127 + 46.128 + private static Optional<DataSource> retrieveDataSource(Context ctx) { 46.129 + DataSource ret = null; 46.130 + try { 46.131 + ret = (DataSource)ctx.lookup(DS_JNDI_NAME); 46.132 + LOG.info("Data source retrieved."); 46.133 + } catch (NamingException ex) { 46.134 + LOG.error("Data source {} not available.", DS_JNDI_NAME); 46.135 + LOG.error("Reason for the missing data source: ", ex); 46.136 + } 46.137 + return Optional.ofNullable(ret); 46.138 + } 46.139 + 46.140 + @Override 46.141 + public void contextInitialized(ServletContextEvent sce) { 46.142 + sc = sce.getServletContext(); 46.143 + 46.144 + dataSource = null; 46.145 + 46.146 + final String contextName = Optional 46.147 + .ofNullable(sc.getInitParameter(Constants.CTX_ATTR_JNDI_CONTEXT)) 46.148 + .orElse("java:comp/env"); 46.149 + final String dbSchema = Optional 46.150 + .ofNullable(sc.getInitParameter(Constants.CTX_ATTR_DB_SCHEMA)) 46.151 + .orElse(DB_DEFAULT_SCHEMA); 46.152 + final String dbDialect = sc.getInitParameter(Constants.CTX_ATTR_DB_DIALECT); 46.153 + if (dbDialect != null) { 46.154 + try { 46.155 + dialect = Dialect.valueOf(dbDialect); 46.156 + } catch (IllegalArgumentException ex) { 46.157 + LOG.error("Unknown or unsupported database dialect {}. Defaulting to {}.", dbDialect, dialect); 46.158 + } 46.159 + } 46.160 + 46.161 + try { 46.162 + LOG.debug("Trying to access JNDI context {}...", contextName); 46.163 + Context initialCtx = new InitialContext(); 46.164 + Context ctx = (Context) initialCtx.lookup(contextName); 46.165 + 46.166 + dataSource = retrieveDataSource(ctx); 46.167 + 46.168 + dataSource.ifPresent((ds) -> checkConnection(ds, dbSchema, "Checking database connection failed")); 46.169 + } catch (NamingException | ClassCastException ex) { 46.170 + LOG.error("Cannot access JNDI resources.", ex); 46.171 + } 46.172 + 46.173 + sc.setAttribute(SC_ATTR_NAME, this); 46.174 + LOG.info("Database facade injected into ServletContext."); 46.175 + } 46.176 + 46.177 + @Override 46.178 + public void contextDestroyed(ServletContextEvent sce) { 46.179 + dataSource = null; 46.180 + } 46.181 +}
47.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 47.2 +++ b/src/main/java/de/uapcore/lightpit/Functions.java Sat May 09 14:26:31 2020 +0200 47.3 @@ -0,0 +1,113 @@ 47.4 +/* 47.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 47.6 + * 47.7 + * Copyright 2018 Mike Becker. All rights reserved. 47.8 + * 47.9 + * Redistribution and use in source and binary forms, with or without 47.10 + * modification, are permitted provided that the following conditions are met: 47.11 + * 47.12 + * 1. Redistributions of source code must retain the above copyright 47.13 + * notice, this list of conditions and the following disclaimer. 47.14 + * 47.15 + * 2. Redistributions in binary form must reproduce the above copyright 47.16 + * notice, this list of conditions and the following disclaimer in the 47.17 + * documentation and/or other materials provided with the distribution. 47.18 + * 47.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 47.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 47.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 47.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 47.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 47.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 47.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 47.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 47.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 47.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 47.29 + * POSSIBILITY OF SUCH DAMAGE. 47.30 + * 47.31 + */ 47.32 +package de.uapcore.lightpit; 47.33 + 47.34 +import java.util.Optional; 47.35 +import javax.servlet.ServletContext; 47.36 +import javax.servlet.http.HttpServletRequest; 47.37 +import org.slf4j.Logger; 47.38 +import org.slf4j.LoggerFactory; 47.39 + 47.40 +/** 47.41 + * Contains common static functions. 47.42 + */ 47.43 +public final class Functions { 47.44 + 47.45 + private static final Logger LOG = LoggerFactory.getLogger(Functions.class); 47.46 + 47.47 + public static Optional<String[]> availableLanguages(ServletContext ctx) { 47.48 + return Optional.ofNullable(ctx.getInitParameter(Constants.CTX_ATTR_LANGUAGES)).map((x) -> x.split("\\s*,\\s*")); 47.49 + } 47.50 + 47.51 + public static String enforceExt(String filename, String ext) { 47.52 + return filename.endsWith(ext) ? filename : filename + ext; 47.53 + } 47.54 + 47.55 + public static String jspPath(String filename) { 47.56 + return enforceExt(Constants.JSP_PATH_PREFIX + filename, ".jsp"); 47.57 + } 47.58 + 47.59 + public static String jspfPath(String filename) { 47.60 + return enforceExt(Constants.JSPF_PATH_PREFIX + filename, ".jspf"); 47.61 + } 47.62 + 47.63 + public static String dynFragmentPath(String filename) { 47.64 + return enforceExt(Constants.DYN_FRAGMENT_PATH_PREFIX + filename, ".jsp"); 47.65 + } 47.66 + 47.67 + public static String fqn(String base, String name) { 47.68 + return base+"."+name; 47.69 + } 47.70 + 47.71 + public static String fqn(Class clazz, String name) { 47.72 + return fqn(clazz.getName(), name); 47.73 + } 47.74 + 47.75 + public static String fullPath(LightPITModule module, RequestMapping mapping) { 47.76 + StringBuilder sb = new StringBuilder(); 47.77 + sb.append(module.modulePath()); 47.78 + sb.append('/'); 47.79 + if (!mapping.requestPath().isEmpty()) { 47.80 + sb.append(mapping.requestPath().isEmpty()); 47.81 + sb.append('/'); 47.82 + } 47.83 + return sb.toString(); 47.84 + } 47.85 + 47.86 + public static String fullPath(HttpServletRequest req) { 47.87 + return req.getServletPath() + Optional.ofNullable(req.getPathInfo()).orElse(""); 47.88 + } 47.89 + 47.90 + /** 47.91 + * Returns the module path of the given LightPIT Servlet module. 47.92 + * 47.93 + * If you specify a malformed LightPIT servlet, which does not have a module 47.94 + * annotation, the path to the <code>/error/404.html</code> page is returned. 47.95 + * 47.96 + * @param clazz the servlet class 47.97 + * @return the module path 47.98 + */ 47.99 + public static String modulePathOf(Class<? extends AbstractLightPITServlet> clazz) { 47.100 + Optional<LightPITModule> moduleInfo = Optional.ofNullable(clazz.getAnnotation(LightPITModule.class)); 47.101 + if (moduleInfo.isPresent()) { 47.102 + return moduleInfo.get().modulePath(); 47.103 + } else { 47.104 + LOG.warn( 47.105 + "{} is a LightPIT Servlet but is missing the module annotation.", 47.106 + clazz.getName() 47.107 + ); 47.108 + return "/error/404.html"; 47.109 + } 47.110 + } 47.111 + 47.112 + /** 47.113 + * This class is not instantiatable. 47.114 + */ 47.115 + private Functions() {} 47.116 +}
48.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 48.2 +++ b/src/main/java/de/uapcore/lightpit/HttpMethod.java Sat May 09 14:26:31 2020 +0200 48.3 @@ -0,0 +1,34 @@ 48.4 +/* 48.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 48.6 + * 48.7 + * Copyright 2018 Mike Becker. All rights reserved. 48.8 + * 48.9 + * Redistribution and use in source and binary forms, with or without 48.10 + * modification, are permitted provided that the following conditions are met: 48.11 + * 48.12 + * 1. Redistributions of source code must retain the above copyright 48.13 + * notice, this list of conditions and the following disclaimer. 48.14 + * 48.15 + * 2. Redistributions in binary form must reproduce the above copyright 48.16 + * notice, this list of conditions and the following disclaimer in the 48.17 + * documentation and/or other materials provided with the distribution. 48.18 + * 48.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 48.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 48.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 48.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 48.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 48.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 48.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 48.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 48.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 48.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 48.29 + * POSSIBILITY OF SUCH DAMAGE. 48.30 + * 48.31 + */ 48.32 +package de.uapcore.lightpit; 48.33 + 48.34 + 48.35 +public enum HttpMethod { 48.36 + GET, POST, PUT, DELETE, TRACE, HEAD, OPTIONS 48.37 +}
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 49.2 +++ b/src/main/java/de/uapcore/lightpit/LightPITModule.java Sat May 09 14:26:31 2020 +0200 49.3 @@ -0,0 +1,170 @@ 49.4 +/* 49.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 49.6 + * 49.7 + * Copyright 2018 Mike Becker. All rights reserved. 49.8 + * 49.9 + * Redistribution and use in source and binary forms, with or without 49.10 + * modification, are permitted provided that the following conditions are met: 49.11 + * 49.12 + * 1. Redistributions of source code must retain the above copyright 49.13 + * notice, this list of conditions and the following disclaimer. 49.14 + * 49.15 + * 2. Redistributions in binary form must reproduce the above copyright 49.16 + * notice, this list of conditions and the following disclaimer in the 49.17 + * documentation and/or other materials provided with the distribution. 49.18 + * 49.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 49.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 49.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 49.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 49.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 49.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 49.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 49.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 49.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 49.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 49.29 + * POSSIBILITY OF SUCH DAMAGE. 49.30 + * 49.31 + */ 49.32 +package de.uapcore.lightpit; 49.33 + 49.34 +import java.lang.annotation.Documented; 49.35 +import java.lang.annotation.ElementType; 49.36 +import java.lang.annotation.Retention; 49.37 +import java.lang.annotation.RetentionPolicy; 49.38 +import java.lang.annotation.Target; 49.39 +import javax.servlet.annotation.WebServlet; 49.40 + 49.41 + 49.42 +/** 49.43 + * Contains information about a LightPIT module. 49.44 + * 49.45 + * This annotation is typically used to annotate the {@link WebServlet} which 49.46 + * implements the module's functionality. 49.47 + */ 49.48 +@Documented 49.49 +@Retention(RetentionPolicy.RUNTIME) 49.50 +@Target(ElementType.TYPE) 49.51 +public @interface LightPITModule { 49.52 + /** 49.53 + * Base name of the module specific resource bundle. 49.54 + * @return a base name suitable for the JSTL tag 'setBundle'. 49.55 + */ 49.56 + String bundleBaseName(); 49.57 + 49.58 + /** 49.59 + * An array of required modules, identified by the string representation of 49.60 + * their class names. 49.61 + * @return an array of class names of required modules 49.62 + */ 49.63 + String[] requires() default {}; 49.64 + 49.65 + /** 49.66 + * The path for this module, which will also be used for the menu entry. 49.67 + * 49.68 + * This path must adhere to the URL pattern of the Servlet but must not 49.69 + * contain any starting or trailing slashes. 49.70 + * 49.71 + * @return the relative module path 49.72 + */ 49.73 + String modulePath(); 49.74 + 49.75 + /** 49.76 + * Returns the properties key for the module name. 49.77 + * 49.78 + * @return the properties key 49.79 + */ 49.80 + String nameKey() default "name"; 49.81 + 49.82 + /** 49.83 + * Returns the properties key for the module description. 49.84 + * 49.85 + * @return the properties key 49.86 + */ 49.87 + String descKey() default "description"; 49.88 + 49.89 + 49.90 + /** 49.91 + * Returns the properties key for the menu label. 49.92 + * 49.93 + * Set this string to empty string, if the module should be hidden from 49.94 + * the menu. 49.95 + * 49.96 + * @return the properties key 49.97 + */ 49.98 + String menuKey() default "menuLabel"; 49.99 + 49.100 + /** 49.101 + * Returns the properties key for the page title. 49.102 + * 49.103 + * By default this is the same as the menu label. 49.104 + * 49.105 + * @return the properties key 49.106 + */ 49.107 + String titleKey() default "menuLabel"; 49.108 + 49.109 + /** 49.110 + * If set to <code>true</code>, this module is always loaded, but never 49.111 + * visible in the menu or the Web UI module manager. 49.112 + * 49.113 + * @return true, if this is a system module 49.114 + */ 49.115 + boolean systemModule() default false; 49.116 + 49.117 + /** 49.118 + * Class representing the annotation. 49.119 + * This is necessary, because the EL resolver cannot deal with 49.120 + * annotation objects. 49.121 + * 49.122 + * Note, that only the properties which are interesting for the JSP pages 49.123 + * are proxied by this object. 49.124 + */ 49.125 + public static class ELProxy { 49.126 + private final String bundleBaseName, modulePath, menuKey, titleKey, nameKey, descKey; 49.127 + 49.128 + public static ELProxy convert(LightPITModule annotation) { 49.129 + return new ELProxy( 49.130 + annotation.bundleBaseName(), 49.131 + annotation.modulePath(), 49.132 + annotation.menuKey(), 49.133 + annotation.titleKey(), 49.134 + annotation.nameKey(), 49.135 + annotation.descKey() 49.136 + ); 49.137 + } 49.138 + 49.139 + private ELProxy(String bundleBaseName, String modulePath, String menuKey, String titleKey, String nameKey, String descKey) { 49.140 + this.bundleBaseName = bundleBaseName; 49.141 + this.modulePath = modulePath; 49.142 + this.menuKey = menuKey; 49.143 + this.titleKey = titleKey; 49.144 + this.nameKey = nameKey; 49.145 + this.descKey = descKey; 49.146 + } 49.147 + 49.148 + public String getBundleBaseName() { 49.149 + return bundleBaseName; 49.150 + } 49.151 + 49.152 + public String getMenuKey() { 49.153 + return menuKey; 49.154 + } 49.155 + 49.156 + public String getModulePath() { 49.157 + return modulePath; 49.158 + } 49.159 + 49.160 + public String getTitleKey() { 49.161 + return titleKey; 49.162 + } 49.163 + 49.164 + public String getNameKey() { 49.165 + return nameKey; 49.166 + } 49.167 + 49.168 + public String getDescKey() { 49.169 + return descKey; 49.170 + } 49.171 + 49.172 + } 49.173 +}
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 50.2 +++ b/src/main/java/de/uapcore/lightpit/Menu.java Sat May 09 14:26:31 2020 +0200 50.3 @@ -0,0 +1,97 @@ 50.4 +/* 50.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 50.6 + * 50.7 + * Copyright 2018 Mike Becker. All rights reserved. 50.8 + * 50.9 + * Redistribution and use in source and binary forms, with or without 50.10 + * modification, are permitted provided that the following conditions are met: 50.11 + * 50.12 + * 1. Redistributions of source code must retain the above copyright 50.13 + * notice, this list of conditions and the following disclaimer. 50.14 + * 50.15 + * 2. Redistributions in binary form must reproduce the above copyright 50.16 + * notice, this list of conditions and the following disclaimer in the 50.17 + * documentation and/or other materials provided with the distribution. 50.18 + * 50.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 50.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 50.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 50.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 50.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 50.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 50.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 50.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 50.29 + * POSSIBILITY OF SUCH DAMAGE. 50.30 + * 50.31 + */ 50.32 +package de.uapcore.lightpit; 50.33 + 50.34 +import java.util.ArrayList; 50.35 +import java.util.Collections; 50.36 +import java.util.List; 50.37 + 50.38 +/** 50.39 + * Maps a resource key for the menu label to the path name for the underlying 50.40 + * site. 50.41 + * 50.42 + * Objects of this class are internally instantiated by the 50.43 + * {@link ModuleManager}. 50.44 + */ 50.45 +public class Menu extends MenuEntry { 50.46 + 50.47 + private final List<MenuEntry> entries = new ArrayList<>(); 50.48 + private final List<MenuEntry> immutableEntries = Collections.unmodifiableList(entries); 50.49 + 50.50 + /** 50.51 + * Class name of the module for which this menu is built. 50.52 + */ 50.53 + private String moduleClassName; 50.54 + 50.55 + 50.56 + public Menu() { 50.57 + super(); 50.58 + } 50.59 + 50.60 + public Menu(String moduleClassName, ResourceKey resourceKey, String pathName) { 50.61 + super(resourceKey, pathName); 50.62 + this.moduleClassName = moduleClassName; 50.63 + } 50.64 + 50.65 + public void setModuleClassName(String moduleClassName) { 50.66 + this.moduleClassName = moduleClassName; 50.67 + } 50.68 + 50.69 + public String getModuleClassName() { 50.70 + return moduleClassName; 50.71 + } 50.72 + 50.73 + /** 50.74 + * Sets a new list of menu entries for this menu. 50.75 + * 50.76 + * @param entries the list of new menu entries 50.77 + */ 50.78 + public void setEntries(List<MenuEntry> entries) { 50.79 + // in case the given list is immutable, we copy the contents 50.80 + this.entries.clear(); 50.81 + this.entries.addAll(entries); 50.82 + } 50.83 + 50.84 + /** 50.85 + * Retrieves an immutable list of menu entries for this menu. 50.86 + * 50.87 + * @return the list of menu entries 50.88 + */ 50.89 + public List<MenuEntry> getEntries() { 50.90 + return immutableEntries; 50.91 + } 50.92 + 50.93 + /** 50.94 + * Adds a new menu entry to this menu. 50.95 + * @param entry the menu entry to add 50.96 + */ 50.97 + public void addMenuEntry(MenuEntry entry) { 50.98 + entries.add(entry); 50.99 + } 50.100 +}
51.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 51.2 +++ b/src/main/java/de/uapcore/lightpit/MenuEntry.java Sat May 09 14:26:31 2020 +0200 51.3 @@ -0,0 +1,74 @@ 51.4 +/* 51.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 51.6 + * 51.7 + * Copyright 2018 Mike Becker. All rights reserved. 51.8 + * 51.9 + * Redistribution and use in source and binary forms, with or without 51.10 + * modification, are permitted provided that the following conditions are met: 51.11 + * 51.12 + * 1. Redistributions of source code must retain the above copyright 51.13 + * notice, this list of conditions and the following disclaimer. 51.14 + * 51.15 + * 2. Redistributions in binary form must reproduce the above copyright 51.16 + * notice, this list of conditions and the following disclaimer in the 51.17 + * documentation and/or other materials provided with the distribution. 51.18 + * 51.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 51.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 51.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 51.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 51.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 51.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 51.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 51.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 51.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 51.29 + * POSSIBILITY OF SUCH DAMAGE. 51.30 + * 51.31 + */ 51.32 +package de.uapcore.lightpit; 51.33 + 51.34 +/** 51.35 + * Maps a resource key for the menu label to the path name for the underlying 51.36 + * site. 51.37 + * 51.38 + * Objects of this class are internally instantiated by the 51.39 + * {@link ModuleManager}. 51.40 + */ 51.41 +public class MenuEntry { 51.42 + 51.43 + /** 51.44 + * Resource key for the menu label. 51.45 + */ 51.46 + private ResourceKey resourceKey; 51.47 + 51.48 + /** 51.49 + * Path name of the module, linked by this menu entry. 51.50 + */ 51.51 + private String pathName; 51.52 + 51.53 + public MenuEntry() { 51.54 + } 51.55 + 51.56 + public MenuEntry(ResourceKey resourceKey, String pathName) { 51.57 + this.resourceKey = resourceKey; 51.58 + this.pathName = pathName; 51.59 + } 51.60 + 51.61 + public void setResourceKey(ResourceKey resourceKey) { 51.62 + this.resourceKey = resourceKey; 51.63 + } 51.64 + 51.65 + public ResourceKey getResourceKey() { 51.66 + return resourceKey; 51.67 + } 51.68 + 51.69 + public void setPathName(String pathName) { 51.70 + this.pathName = pathName; 51.71 + } 51.72 + 51.73 + public String getPathName() { 51.74 + return pathName; 51.75 + } 51.76 + 51.77 +}
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 52.2 +++ b/src/main/java/de/uapcore/lightpit/ModuleManager.java Sat May 09 14:26:31 2020 +0200 52.3 @@ -0,0 +1,231 @@ 52.4 +/* 52.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 52.6 + * 52.7 + * Copyright 2018 Mike Becker. All rights reserved. 52.8 + * 52.9 + * Redistribution and use in source and binary forms, with or without 52.10 + * modification, are permitted provided that the following conditions are met: 52.11 + * 52.12 + * 1. Redistributions of source code must retain the above copyright 52.13 + * notice, this list of conditions and the following disclaimer. 52.14 + * 52.15 + * 2. Redistributions in binary form must reproduce the above copyright 52.16 + * notice, this list of conditions and the following disclaimer in the 52.17 + * documentation and/or other materials provided with the distribution. 52.18 + * 52.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 52.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 52.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 52.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 52.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 52.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 52.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 52.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 52.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 52.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 52.29 + * POSSIBILITY OF SUCH DAMAGE. 52.30 + * 52.31 + */ 52.32 +package de.uapcore.lightpit; 52.33 + 52.34 +import de.uapcore.lightpit.entities.CoreDAOFactory; 52.35 +import de.uapcore.lightpit.entities.Module; 52.36 +import de.uapcore.lightpit.entities.ModuleDao; 52.37 +import java.sql.Connection; 52.38 +import java.sql.SQLException; 52.39 +import java.util.Collections; 52.40 +import java.util.HashMap; 52.41 +import java.util.List; 52.42 +import java.util.Map; 52.43 +import java.util.Optional; 52.44 +import java.util.concurrent.atomic.AtomicBoolean; 52.45 +import java.util.stream.Collectors; 52.46 +import javax.servlet.Registration; 52.47 +import javax.servlet.ServletContext; 52.48 +import javax.servlet.ServletContextEvent; 52.49 +import javax.servlet.ServletContextListener; 52.50 +import javax.servlet.annotation.WebListener; 52.51 +import org.slf4j.Logger; 52.52 +import org.slf4j.LoggerFactory; 52.53 + 52.54 +/** 52.55 + * Scans registered servlets for LightPIT modules. 52.56 + */ 52.57 +@WebListener 52.58 +public final class ModuleManager implements ServletContextListener { 52.59 + 52.60 + private static final Logger LOG = LoggerFactory.getLogger(ModuleManager.class); 52.61 + 52.62 + /** 52.63 + * The attribute name in the servlet context under which an instance of this class can be found. 52.64 + */ 52.65 + public static final String SC_ATTR_NAME = ModuleManager.class.getName(); 52.66 + private ServletContext sc; 52.67 + 52.68 + /** 52.69 + * Maps class names to module information. 52.70 + */ 52.71 + private final Map<String, LightPITModule> registeredModules = new HashMap<>(); 52.72 + 52.73 + /** 52.74 + * This flag is true, when synchronization is needed. 52.75 + */ 52.76 + private final AtomicBoolean dirty = new AtomicBoolean(true); 52.77 + 52.78 + @Override 52.79 + public void contextInitialized(ServletContextEvent sce) { 52.80 + sc = sce.getServletContext(); 52.81 + reloadAll(); 52.82 + sc.setAttribute(SC_ATTR_NAME, this); 52.83 + LOG.info("Module manager injected into ServletContext."); 52.84 + } 52.85 + 52.86 + @Override 52.87 + public void contextDestroyed(ServletContextEvent sce) { 52.88 + unloadAll(); 52.89 + } 52.90 + 52.91 + private Optional<LightPITModule> getModuleInfo(Registration reg) { 52.92 + try { 52.93 + final Class scclass = Class.forName(reg.getClassName()); 52.94 + 52.95 + final boolean lpservlet = AbstractLightPITServlet.class.isAssignableFrom(scclass); 52.96 + final boolean lpmodule = scclass.isAnnotationPresent(LightPITModule.class); 52.97 + 52.98 + if (lpservlet && !lpmodule) { 52.99 + LOG.warn( 52.100 + "{} is a LightPIT Servlet but is missing the module annotation.", 52.101 + reg.getClassName() 52.102 + ); 52.103 + } else if (!lpservlet && lpmodule) { 52.104 + LOG.warn( 52.105 + "{} is annotated as a LightPIT Module but does not extend {}.", 52.106 + reg.getClassName(), 52.107 + AbstractLightPITServlet.class.getSimpleName() 52.108 + ); 52.109 + } 52.110 + 52.111 + if (lpservlet && lpmodule) { 52.112 + final Class<? extends AbstractLightPITServlet> clazz = scclass; 52.113 + final LightPITModule moduleInfo = clazz.getAnnotation(LightPITModule.class); 52.114 + return Optional.of(moduleInfo); 52.115 + } else { 52.116 + return Optional.empty(); 52.117 + } 52.118 + } catch (ClassNotFoundException ex) { 52.119 + LOG.error( 52.120 + "Servlet registration refers to class {} which cannot be found by the class loader (Reason: {})", 52.121 + reg.getClassName(), 52.122 + ex.getMessage() 52.123 + ); 52.124 + return Optional.empty(); 52.125 + } 52.126 + } 52.127 + 52.128 + private void handleServletRegistration(String name, Registration reg) { 52.129 + final Optional<LightPITModule> moduleInfo = getModuleInfo(reg); 52.130 + if (moduleInfo.isPresent()) { 52.131 + registeredModules.put(reg.getClassName(), moduleInfo.get()); 52.132 + LOG.info("Module detected: {}", name); 52.133 + } else { 52.134 + LOG.debug("Servlet {} is no module, skipping.", name); 52.135 + } 52.136 + } 52.137 + 52.138 + /** 52.139 + * Scans for modules and reloads them all. 52.140 + */ 52.141 + public void reloadAll() { 52.142 + registeredModules.clear(); 52.143 + sc.getServletRegistrations().forEach(this::handleServletRegistration); 52.144 + 52.145 + // TODO: implement dependency resolver 52.146 + 52.147 + dirty.set(true); 52.148 + LOG.info("Modules loaded."); 52.149 + } 52.150 + 52.151 + /** 52.152 + * Synchronizes module information with the database. 52.153 + * 52.154 + * This must be called from the {@link AbstractLightPITServlet}. 52.155 + * Admittedly the call will perform the synchronization once after reload 52.156 + * and be a no-op, afterwards. 52.157 + * However, we since the DatabaseFacade might be loaded after the module 52.158 + * manager, we must defer the synchronization to the first request 52.159 + * handled by the Servlet. 52.160 + * 52.161 + * @param db interface to the database 52.162 + */ 52.163 + public void syncWithDatabase(DatabaseFacade db) { 52.164 + if (dirty.compareAndSet(true, false)) { 52.165 + if (db.getDataSource().isPresent()) { 52.166 + try (Connection conn = db.getDataSource().get().getConnection()) { 52.167 + final ModuleDao moduleDao = CoreDAOFactory.getModuleDao(db.getSQLDialect()); 52.168 + moduleDao.syncRegisteredModuleClasses(conn, registeredModules.entrySet()); 52.169 + } catch (SQLException ex) { 52.170 + LOG.error("Unexpected SQL Exception", ex); 52.171 + } 52.172 + } else { 52.173 + LOG.error("No datasource present. Cannot sync module information with database."); 52.174 + } 52.175 + } else { 52.176 + LOG.trace("Module information clean - no synchronization required."); 52.177 + } 52.178 + } 52.179 + 52.180 + /** 52.181 + * Unloads all found modules. 52.182 + */ 52.183 + public void unloadAll() { 52.184 + registeredModules.clear(); 52.185 + LOG.info("All modules unloaded."); 52.186 + } 52.187 + 52.188 + /** 52.189 + * Returns the main menu. 52.190 + * 52.191 + * @param db the interface to the database 52.192 + * @return a list of menus belonging to the main menu 52.193 + */ 52.194 + public List<Menu> getMainMenu(DatabaseFacade db) { 52.195 + // TODO: user specific menu 52.196 + 52.197 + if (db.getDataSource().isPresent()) { 52.198 + try (Connection conn = db.getDataSource().get().getConnection()) { 52.199 + final ModuleDao dao = CoreDAOFactory.getModuleDao(db.getSQLDialect()); 52.200 + final List<Module> modules = dao.listAll(conn); 52.201 + 52.202 + final List<Menu> menu = modules 52.203 + .stream() 52.204 + .filter((mod) -> mod.isVisible()) 52.205 + .collect(Collectors.mapping( 52.206 + (mod) -> new Menu( 52.207 + mod.getClassname(), 52.208 + new ResourceKey( 52.209 + registeredModules.get(mod.getClassname()).bundleBaseName(), 52.210 + registeredModules.get(mod.getClassname()).menuKey()), 52.211 + registeredModules.get(mod.getClassname()).modulePath()), 52.212 + Collectors.toList()) 52.213 + ); 52.214 + return menu; 52.215 + } catch (SQLException ex) { 52.216 + LOG.error("Unexpected SQLException when loading the main menu", ex); 52.217 + return Collections.emptyList(); 52.218 + } 52.219 + } else { 52.220 + return Collections.emptyList(); 52.221 + } 52.222 + } 52.223 + 52.224 + /** 52.225 + * Returns an unmodifiable map of all registered modules. 52.226 + * 52.227 + * The key is the classname of the module. 52.228 + * 52.229 + * @return the map of registered modules 52.230 + */ 52.231 + public Map<String, LightPITModule> getRegisteredModules() { 52.232 + return Collections.unmodifiableMap(registeredModules); 52.233 + } 52.234 +}
53.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 53.2 +++ b/src/main/java/de/uapcore/lightpit/RequestMapping.java Sat May 09 14:26:31 2020 +0200 53.3 @@ -0,0 +1,76 @@ 53.4 +/* 53.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 53.6 + * 53.7 + * Copyright 2018 Mike Becker. All rights reserved. 53.8 + * 53.9 + * Redistribution and use in source and binary forms, with or without 53.10 + * modification, are permitted provided that the following conditions are met: 53.11 + * 53.12 + * 1. Redistributions of source code must retain the above copyright 53.13 + * notice, this list of conditions and the following disclaimer. 53.14 + * 53.15 + * 2. Redistributions in binary form must reproduce the above copyright 53.16 + * notice, this list of conditions and the following disclaimer in the 53.17 + * documentation and/or other materials provided with the distribution. 53.18 + * 53.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 53.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 53.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 53.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 53.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 53.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 53.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 53.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 53.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 53.29 + * POSSIBILITY OF SUCH DAMAGE. 53.30 + * 53.31 + */ 53.32 +package de.uapcore.lightpit; 53.33 + 53.34 +import java.lang.annotation.Documented; 53.35 +import java.lang.annotation.ElementType; 53.36 +import java.lang.annotation.Retention; 53.37 +import java.lang.annotation.RetentionPolicy; 53.38 +import java.lang.annotation.Target; 53.39 + 53.40 + 53.41 +/** 53.42 + * Maps requests to methods. 53.43 + * 53.44 + * This annotation is used to annotate methods within classes which 53.45 + * override {@link AbstractLightPITServlet}. 53.46 + */ 53.47 +@Documented 53.48 +@Retention(RetentionPolicy.RUNTIME) 53.49 +@Target(ElementType.METHOD) 53.50 +public @interface RequestMapping { 53.51 + 53.52 + /** 53.53 + * Specifies the HTTP method. 53.54 + * 53.55 + * @return the HTTP method handled by the annotated Java method 53.56 + */ 53.57 + HttpMethod method(); 53.58 + 53.59 + /** 53.60 + * Specifies the request path relative to the module path. 53.61 + * 53.62 + * If a menu key is specified, this is also the path, which is linked 53.63 + * by the menu entry. 53.64 + * 53.65 + * The path must be specified <em>without</em> leading and trailing slash. 53.66 + * 53.67 + * @return the request path the annotated method should handle 53.68 + */ 53.69 + String requestPath() default ""; 53.70 + 53.71 + /** 53.72 + * Returns the properties key for the (sub) menu label. 53.73 + * 53.74 + * This should only be used for {@link HttpMethod#GET} requests. 53.75 + * 53.76 + * @return the properties key 53.77 + */ 53.78 + String menuKey() default ""; 53.79 +}
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 54.2 +++ b/src/main/java/de/uapcore/lightpit/ResourceKey.java Sat May 09 14:26:31 2020 +0200 54.3 @@ -0,0 +1,62 @@ 54.4 +/* 54.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 54.6 + * 54.7 + * Copyright 2018 Mike Becker. All rights reserved. 54.8 + * 54.9 + * Redistribution and use in source and binary forms, with or without 54.10 + * modification, are permitted provided that the following conditions are met: 54.11 + * 54.12 + * 1. Redistributions of source code must retain the above copyright 54.13 + * notice, this list of conditions and the following disclaimer. 54.14 + * 54.15 + * 2. Redistributions in binary form must reproduce the above copyright 54.16 + * notice, this list of conditions and the following disclaimer in the 54.17 + * documentation and/or other materials provided with the distribution. 54.18 + * 54.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 54.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 54.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 54.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 54.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 54.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 54.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 54.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 54.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 54.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 54.29 + * POSSIBILITY OF SUCH DAMAGE. 54.30 + * 54.31 + */ 54.32 +package de.uapcore.lightpit; 54.33 + 54.34 +/** 54.35 + * Fully specifies a resource key by the bundle and the key name. 54.36 + */ 54.37 +public final class ResourceKey { 54.38 + private String bundle; 54.39 + private String key; 54.40 + 54.41 + public ResourceKey() { 54.42 + 54.43 + } 54.44 + 54.45 + public ResourceKey(String bundle, String key) { 54.46 + this.bundle = bundle; 54.47 + this.key = key; 54.48 + } 54.49 + 54.50 + public void setBundle(String bundle) { 54.51 + this.bundle = bundle; 54.52 + } 54.53 + 54.54 + public String getBundle() { 54.55 + return bundle; 54.56 + } 54.57 + 54.58 + public void setKey(String key) { 54.59 + this.key = key; 54.60 + } 54.61 + 54.62 + public String getKey() { 54.63 + return key; 54.64 + } 54.65 +}
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 55.2 +++ b/src/main/java/de/uapcore/lightpit/ResponseType.java Sat May 09 14:26:31 2020 +0200 55.3 @@ -0,0 +1,56 @@ 55.4 +/* 55.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 55.6 + * 55.7 + * Copyright 2018 Mike Becker. All rights reserved. 55.8 + * 55.9 + * Redistribution and use in source and binary forms, with or without 55.10 + * modification, are permitted provided that the following conditions are met: 55.11 + * 55.12 + * 1. Redistributions of source code must retain the above copyright 55.13 + * notice, this list of conditions and the following disclaimer. 55.14 + * 55.15 + * 2. Redistributions in binary form must reproduce the above copyright 55.16 + * notice, this list of conditions and the following disclaimer in the 55.17 + * documentation and/or other materials provided with the distribution. 55.18 + * 55.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 55.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 55.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 55.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 55.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 55.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 55.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 55.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 55.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 55.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 55.29 + * POSSIBILITY OF SUCH DAMAGE. 55.30 + * 55.31 + */ 55.32 +package de.uapcore.lightpit; 55.33 + 55.34 + 55.35 +public enum ResponseType { 55.36 + /** 55.37 + * Renders a full HTML view including the header. 55.38 + */ 55.39 + HTML_FULL, 55.40 + /** 55.41 + * Renders a HTML fragment only. 55.42 + * May be used for AJAX responses. 55.43 + */ 55.44 + HTML_FRAGMENT, 55.45 + /** 55.46 + * Returns a fragment with content type 'text/plain'. 55.47 + */ 55.48 + PLAIN, 55.49 + /** 55.50 + * Returns an object in JSON format and with content type 55.51 + * 'application/json'. 55.52 + */ 55.53 + JSON, 55.54 + /** 55.55 + * The handler already sent the output, nothing should be done 55.56 + * additionally by the Servlet. 55.57 + */ 55.58 + NONE 55.59 +}
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 56.2 +++ b/src/main/java/de/uapcore/lightpit/entities/CoreDAOFactory.java Sat May 09 14:26:31 2020 +0200 56.3 @@ -0,0 +1,47 @@ 56.4 +/* 56.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 56.6 + * 56.7 + * Copyright 2018 Mike Becker. All rights reserved. 56.8 + * 56.9 + * Redistribution and use in source and binary forms, with or without 56.10 + * modification, are permitted provided that the following conditions are met: 56.11 + * 56.12 + * 1. Redistributions of source code must retain the above copyright 56.13 + * notice, this list of conditions and the following disclaimer. 56.14 + * 56.15 + * 2. Redistributions in binary form must reproduce the above copyright 56.16 + * notice, this list of conditions and the following disclaimer in the 56.17 + * documentation and/or other materials provided with the distribution. 56.18 + * 56.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 56.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 56.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 56.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 56.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 56.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 56.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 56.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 56.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 56.29 + * POSSIBILITY OF SUCH DAMAGE. 56.30 + * 56.31 + */ 56.32 +package de.uapcore.lightpit.entities; 56.33 + 56.34 +import de.uapcore.lightpit.DatabaseFacade; 56.35 + 56.36 +public final class CoreDAOFactory { 56.37 + 56.38 + private CoreDAOFactory() {} 56.39 + 56.40 + private static class PostgresDaos { 56.41 + static final ModuleDao MODULE_DAO = new PostgresModuleDao(); 56.42 + } 56.43 + 56.44 + public static ModuleDao getModuleDao(DatabaseFacade.Dialect dialect) { 56.45 + switch (dialect) { 56.46 + case Postgres: return PostgresDaos.MODULE_DAO; 56.47 + default: assert(false); return null; 56.48 + } 56.49 + } 56.50 +}
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 57.2 +++ b/src/main/java/de/uapcore/lightpit/entities/Module.java Sat May 09 14:26:31 2020 +0200 57.3 @@ -0,0 +1,90 @@ 57.4 +/* 57.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 57.6 + * 57.7 + * Copyright 2018 Mike Becker. All rights reserved. 57.8 + * 57.9 + * Redistribution and use in source and binary forms, with or without 57.10 + * modification, are permitted provided that the following conditions are met: 57.11 + * 57.12 + * 1. Redistributions of source code must retain the above copyright 57.13 + * notice, this list of conditions and the following disclaimer. 57.14 + * 57.15 + * 2. Redistributions in binary form must reproduce the above copyright 57.16 + * notice, this list of conditions and the following disclaimer in the 57.17 + * documentation and/or other materials provided with the distribution. 57.18 + * 57.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 57.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 57.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 57.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 57.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 57.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 57.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 57.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 57.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 57.29 + * POSSIBILITY OF SUCH DAMAGE. 57.30 + * 57.31 + */ 57.32 +package de.uapcore.lightpit.entities; 57.33 + 57.34 +import de.uapcore.lightpit.LightPITModule; 57.35 + 57.36 +public final class Module { 57.37 + private int modID; 57.38 + private String classname; 57.39 + private boolean visible; 57.40 + 57.41 + private LightPITModule.ELProxy annotatedInfos; 57.42 + 57.43 + public int getModID() { 57.44 + return modID; 57.45 + } 57.46 + 57.47 + public void setModID(int modID) { 57.48 + this.modID = modID; 57.49 + } 57.50 + 57.51 + public String getClassname() { 57.52 + return classname; 57.53 + } 57.54 + 57.55 + public void setClassname(String classname) { 57.56 + this.classname = classname; 57.57 + } 57.58 + 57.59 + public boolean isVisible() { 57.60 + return visible; 57.61 + } 57.62 + 57.63 + public void setVisible(boolean visible) { 57.64 + this.visible = visible; 57.65 + } 57.66 + 57.67 + public LightPITModule.ELProxy getAnnotatedInfos() { 57.68 + return annotatedInfos; 57.69 + } 57.70 + 57.71 + public void setAnnotatedInfos(LightPITModule.ELProxy annotatedInfos) { 57.72 + this.annotatedInfos = annotatedInfos; 57.73 + } 57.74 + 57.75 + @Override 57.76 + public int hashCode() { 57.77 + int hash = 3; 57.78 + hash = 41 * hash + this.modID; 57.79 + return hash; 57.80 + } 57.81 + 57.82 + @Override 57.83 + public boolean equals(Object obj) { 57.84 + if (this == obj) { 57.85 + return true; 57.86 + } 57.87 + if (obj == null || getClass() != obj.getClass()) { 57.88 + return false; 57.89 + } else { 57.90 + return this.modID == ((Module) obj).modID; 57.91 + } 57.92 + } 57.93 +}
58.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 58.2 +++ b/src/main/java/de/uapcore/lightpit/entities/ModuleDao.java Sat May 09 14:26:31 2020 +0200 58.3 @@ -0,0 +1,141 @@ 58.4 +/* 58.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 58.6 + * 58.7 + * Copyright 2018 Mike Becker. All rights reserved. 58.8 + * 58.9 + * Redistribution and use in source and binary forms, with or without 58.10 + * modification, are permitted provided that the following conditions are met: 58.11 + * 58.12 + * 1. Redistributions of source code must retain the above copyright 58.13 + * notice, this list of conditions and the following disclaimer. 58.14 + * 58.15 + * 2. Redistributions in binary form must reproduce the above copyright 58.16 + * notice, this list of conditions and the following disclaimer in the 58.17 + * documentation and/or other materials provided with the distribution. 58.18 + * 58.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 58.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 58.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 58.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 58.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 58.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 58.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 58.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 58.29 + * POSSIBILITY OF SUCH DAMAGE. 58.30 + * 58.31 + */ 58.32 +package de.uapcore.lightpit.entities; 58.33 + 58.34 +import de.uapcore.lightpit.LightPITModule; 58.35 +import java.sql.Connection; 58.36 +import java.sql.PreparedStatement; 58.37 +import java.sql.ResultSet; 58.38 +import java.sql.SQLException; 58.39 +import java.sql.Statement; 58.40 +import java.util.ArrayList; 58.41 +import java.util.List; 58.42 +import java.util.Map; 58.43 +import java.util.Set; 58.44 + 58.45 +public abstract class ModuleDao { 58.46 + 58.47 + /** 58.48 + * Maps database columns to POJO fields. 58.49 + * @param result the database result set 58.50 + * @param mod the POJO 58.51 + * @throws SQLException 58.52 + */ 58.53 + protected void mapColumns(ResultSet result, Module mod) throws SQLException { 58.54 + mod.setModID(result.getInt("modid")); 58.55 + mod.setClassname(result.getString("classname")); 58.56 + mod.setVisible(result.getBoolean("visible")); 58.57 + } 58.58 + 58.59 + 58.60 + /** 58.61 + * Must return a prepared statement for a single object query with the specified properties. 58.62 + * 58.63 + * <ul> 58.64 + * <li>Parameter 1: classname</li> 58.65 + * <li>Result field 1: visible</li> 58.66 + * </ul> 58.67 + * 58.68 + * @param conn the connection to use 58.69 + * @return the prepared statement 58.70 + * @throws SQLException 58.71 + */ 58.72 + protected PreparedStatement moduleCheckStatement(Connection conn) throws SQLException { 58.73 + return conn.prepareStatement("SELECT visible FROM lpitcore_module WHERE classname = ?"); 58.74 + } 58.75 + 58.76 + /** 58.77 + * Must return a prepared statement for insertion with the specified properties. 58.78 + * 58.79 + * <ul> 58.80 + * <li>Parameter 1: classname</li> 58.81 + * <li>Parameter 2: visible</li> 58.82 + * </ul> 58.83 + * 58.84 + * @param conn the connection to use 58.85 + * @return the prepared statement 58.86 + * @throws SQLException 58.87 + */ 58.88 + protected PreparedStatement moduleInsertStatement(Connection conn) throws SQLException { 58.89 + return conn.prepareStatement("INSERT INTO lpitcore_module (classname, visible) VALUES (?, ?)"); 58.90 + } 58.91 + 58.92 + /** 58.93 + * Synchronizes a set of registered module classes with the database. 58.94 + * 58.95 + * Inserts module classes which are not known to the database and sets them to be visible by default. 58.96 + * Module classes known to the database, which are not in the given set, are ignored. 58.97 + * 58.98 + * @param conn the connection to use 58.99 + * @param moduleSet the module set to synchronize 58.100 + * @throws SQLException 58.101 + */ 58.102 + public final void syncRegisteredModuleClasses(Connection conn, Set<Map.Entry<String, LightPITModule>> moduleSet) throws SQLException { 58.103 + 58.104 + PreparedStatement 58.105 + check = moduleCheckStatement(conn), 58.106 + insert = moduleInsertStatement(conn); 58.107 + insert.setBoolean(2, true); 58.108 + // update/delete not required, we do this in the module management UI 58.109 + 58.110 + for (Map.Entry<String, LightPITModule> modEntry : moduleSet) { 58.111 + if (modEntry.getValue().systemModule()) continue; 58.112 + 58.113 + check.setString(1, modEntry.getKey()); 58.114 + try (ResultSet r = check.executeQuery()) { 58.115 + if (!r.next()) { 58.116 + insert.setString(1, modEntry.getKey()); 58.117 + insert.executeUpdate(); 58.118 + } 58.119 + } 58.120 + } 58.121 + } 58.122 + 58.123 + /** 58.124 + * Returns a list of all modules known by the database. 58.125 + * 58.126 + * Keep in mind, that system modules are never known to the database. 58.127 + * 58.128 + * @param conn the connection to use 58.129 + * @return a list of all modules known by the database 58.130 + * @throws SQLException 58.131 + */ 58.132 + public List<Module> listAll(Connection conn) throws SQLException { 58.133 + List<Module> list = new ArrayList<>(); 58.134 + try (Statement stmt = conn.createStatement(); 58.135 + ResultSet result = stmt.executeQuery("SELECT * FROM lpitcore_module")) { 58.136 + while (result.next()) { 58.137 + final Module mod = new Module(); 58.138 + mapColumns(result, mod); 58.139 + list.add(mod); 58.140 + } 58.141 + } 58.142 + return list; 58.143 + } 58.144 +}
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 59.2 +++ b/src/main/java/de/uapcore/lightpit/entities/PostgresModuleDao.java Sat May 09 14:26:31 2020 +0200 59.3 @@ -0,0 +1,33 @@ 59.4 +/* 59.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 59.6 + * 59.7 + * Copyright 2018 Mike Becker. All rights reserved. 59.8 + * 59.9 + * Redistribution and use in source and binary forms, with or without 59.10 + * modification, are permitted provided that the following conditions are met: 59.11 + * 59.12 + * 1. Redistributions of source code must retain the above copyright 59.13 + * notice, this list of conditions and the following disclaimer. 59.14 + * 59.15 + * 2. Redistributions in binary form must reproduce the above copyright 59.16 + * notice, this list of conditions and the following disclaimer in the 59.17 + * documentation and/or other materials provided with the distribution. 59.18 + * 59.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 59.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 59.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 59.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 59.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 59.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 59.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 59.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 59.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 59.29 + * POSSIBILITY OF SUCH DAMAGE. 59.30 + * 59.31 + */ 59.32 +package de.uapcore.lightpit.entities; 59.33 + 59.34 +public class PostgresModuleDao extends ModuleDao { 59.35 + // No overrides needed. 59.36 +}
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 60.2 +++ b/src/main/java/de/uapcore/lightpit/entities/User.java Sat May 09 14:26:31 2020 +0200 60.3 @@ -0,0 +1,92 @@ 60.4 +/* 60.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 60.6 + * 60.7 + * Copyright 2018 Mike Becker. All rights reserved. 60.8 + * 60.9 + * Redistribution and use in source and binary forms, with or without 60.10 + * modification, are permitted provided that the following conditions are met: 60.11 + * 60.12 + * 1. Redistributions of source code must retain the above copyright 60.13 + * notice, this list of conditions and the following disclaimer. 60.14 + * 60.15 + * 2. Redistributions in binary form must reproduce the above copyright 60.16 + * notice, this list of conditions and the following disclaimer in the 60.17 + * documentation and/or other materials provided with the distribution. 60.18 + * 60.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 60.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 60.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 60.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 60.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 60.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 60.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 60.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 60.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 60.29 + * POSSIBILITY OF SUCH DAMAGE. 60.30 + * 60.31 + */ 60.32 +package de.uapcore.lightpit.entities; 60.33 + 60.34 +import java.util.Optional; 60.35 + 60.36 +public final class User { 60.37 + 60.38 + public static final int ANONYMOUS_USERID = -1; 60.39 + 60.40 + private int userID; 60.41 + private String username; 60.42 + private Optional<String> givenname; 60.43 + private Optional<String> lastname; 60.44 + 60.45 + public int getUserID() { 60.46 + return userID; 60.47 + } 60.48 + 60.49 + public void setUserID(int userID) { 60.50 + this.userID = userID; 60.51 + } 60.52 + 60.53 + public String getUsername() { 60.54 + return username; 60.55 + } 60.56 + 60.57 + public void setUsername(String username) { 60.58 + this.username = username; 60.59 + } 60.60 + 60.61 + public Optional<String> getGivenname() { 60.62 + return givenname; 60.63 + } 60.64 + 60.65 + public void setGivenname(Optional<String> givenname) { 60.66 + this.givenname = givenname; 60.67 + } 60.68 + 60.69 + public Optional<String> getLastname() { 60.70 + return lastname; 60.71 + } 60.72 + 60.73 + public void setLastname(Optional<String> lastname) { 60.74 + this.lastname = lastname; 60.75 + } 60.76 + 60.77 + @Override 60.78 + public int hashCode() { 60.79 + int hash = 3; 60.80 + hash = 41 * hash + this.userID; 60.81 + return hash; 60.82 + } 60.83 + 60.84 + @Override 60.85 + public boolean equals(Object obj) { 60.86 + if (this == obj) { 60.87 + return true; 60.88 + } 60.89 + if (obj == null || getClass() != obj.getClass()) { 60.90 + return false; 60.91 + } else { 60.92 + return this.userID == ((User) obj).userID; 60.93 + } 60.94 + } 60.95 +}
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 61.2 +++ b/src/main/java/de/uapcore/lightpit/entities/UserDao.java Sat May 09 14:26:31 2020 +0200 61.3 @@ -0,0 +1,77 @@ 61.4 +/* 61.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 61.6 + * 61.7 + * Copyright 2018 Mike Becker. All rights reserved. 61.8 + * 61.9 + * Redistribution and use in source and binary forms, with or without 61.10 + * modification, are permitted provided that the following conditions are met: 61.11 + * 61.12 + * 1. Redistributions of source code must retain the above copyright 61.13 + * notice, this list of conditions and the following disclaimer. 61.14 + * 61.15 + * 2. Redistributions in binary form must reproduce the above copyright 61.16 + * notice, this list of conditions and the following disclaimer in the 61.17 + * documentation and/or other materials provided with the distribution. 61.18 + * 61.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 61.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 61.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 61.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 61.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 61.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 61.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 61.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 61.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 61.29 + * POSSIBILITY OF SUCH DAMAGE. 61.30 + * 61.31 + */ 61.32 +package de.uapcore.lightpit.entities; 61.33 + 61.34 +import java.sql.Connection; 61.35 +import java.sql.ResultSet; 61.36 +import java.sql.SQLException; 61.37 +import java.sql.Statement; 61.38 +import java.util.ArrayList; 61.39 +import java.util.List; 61.40 +import java.util.Optional; 61.41 + 61.42 +public abstract class UserDao { 61.43 + 61.44 + /** 61.45 + * Maps SQL columns to POJO fields. 61.46 + * @param result the database result set 61.47 + * @param user the POJO 61.48 + * @throws SQLException 61.49 + */ 61.50 + protected void mapColumns(ResultSet result, User user) throws SQLException { 61.51 + user.setUserID(result.getInt("userid")); 61.52 + user.setUsername(result.getString("username")); 61.53 + user.setGivenname(Optional.ofNullable(result.getString("givenname"))); 61.54 + user.setLastname(Optional.ofNullable(result.getString("lastname"))); 61.55 + } 61.56 + 61.57 + /** 61.58 + * Returns a list of all users ordered by their username. 61.59 + * 61.60 + * Does not return reserved system users with negative user IDs. 61.61 + * 61.62 + * @param conn the connection to use 61.63 + * @return a list of all users 61.64 + * @throws SQLException 61.65 + */ 61.66 + public List<User> listAll(Connection conn) throws SQLException { 61.67 + List<User> list = new ArrayList<>(); 61.68 + try ( 61.69 + Statement stmt = conn.createStatement(); 61.70 + ResultSet result = stmt.executeQuery( 61.71 + "SELECT * FROM lpitcore_user WHERE userid >= 0 ORDER BY username")) { 61.72 + while (result.next()) { 61.73 + final User user = new User(); 61.74 + mapColumns(result, user); 61.75 + list.add(user); 61.76 + } 61.77 + } 61.78 + return list; 61.79 + } 61.80 +}
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 62.2 +++ b/src/main/java/de/uapcore/lightpit/modules/ErrorModule.java Sat May 09 14:26:31 2020 +0200 62.3 @@ -0,0 +1,80 @@ 62.4 +/* 62.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 62.6 + * 62.7 + * Copyright 2018 Mike Becker. All rights reserved. 62.8 + * 62.9 + * Redistribution and use in source and binary forms, with or without 62.10 + * modification, are permitted provided that the following conditions are met: 62.11 + * 62.12 + * 1. Redistributions of source code must retain the above copyright 62.13 + * notice, this list of conditions and the following disclaimer. 62.14 + * 62.15 + * 2. Redistributions in binary form must reproduce the above copyright 62.16 + * notice, this list of conditions and the following disclaimer in the 62.17 + * documentation and/or other materials provided with the distribution. 62.18 + * 62.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 62.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 62.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 62.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 62.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 62.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 62.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 62.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 62.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 62.29 + * POSSIBILITY OF SUCH DAMAGE. 62.30 + * 62.31 + */ 62.32 +package de.uapcore.lightpit.modules; 62.33 + 62.34 +import de.uapcore.lightpit.LightPITModule; 62.35 +import de.uapcore.lightpit.AbstractLightPITServlet; 62.36 +import de.uapcore.lightpit.HttpMethod; 62.37 +import de.uapcore.lightpit.RequestMapping; 62.38 +import de.uapcore.lightpit.ResponseType; 62.39 +import javax.servlet.annotation.WebServlet; 62.40 +import javax.servlet.http.HttpServletRequest; 62.41 +import javax.servlet.http.HttpServletResponse; 62.42 + 62.43 +/** 62.44 + * Entry point for the application. 62.45 + */ 62.46 +@LightPITModule( 62.47 + bundleBaseName = "localization.error", 62.48 + modulePath = "error", 62.49 + titleKey = "title", 62.50 + systemModule = true 62.51 +) 62.52 +@WebServlet( 62.53 + name = "ErrorModule", 62.54 + urlPatterns = "/error/*" 62.55 +) 62.56 +public final class ErrorModule extends AbstractLightPITServlet { 62.57 + 62.58 + public static final String REQ_ATTR_ERROR_CODE = "errorCode"; 62.59 + 62.60 + private ResponseType handle(HttpServletRequest req, HttpServletResponse resp, int sc) { 62.61 + 62.62 + req.setAttribute(REQ_ATTR_ERROR_CODE, sc); 62.63 + setStylesheet(req, "error"); 62.64 + setDynamicFragment(req, "error"); 62.65 + 62.66 + return ResponseType.HTML_FULL; 62.67 + } 62.68 + 62.69 + @RequestMapping(requestPath = "404", method = HttpMethod.GET) 62.70 + public ResponseType handle404(HttpServletRequest req, HttpServletResponse resp) { 62.71 + return handle(req, resp, 404); 62.72 + } 62.73 + 62.74 + @RequestMapping(requestPath = "403", method = HttpMethod.GET) 62.75 + public ResponseType handle403(HttpServletRequest req, HttpServletResponse resp) { 62.76 + return handle(req, resp, 403); 62.77 + } 62.78 + 62.79 + @RequestMapping(requestPath = "500", method = HttpMethod.GET) 62.80 + public ResponseType handle500(HttpServletRequest req, HttpServletResponse resp) { 62.81 + return handle(req, resp, 500); 62.82 + } 62.83 +}
63.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 63.2 +++ b/src/main/java/de/uapcore/lightpit/modules/HomeModule.java Sat May 09 14:26:31 2020 +0200 63.3 @@ -0,0 +1,58 @@ 63.4 +/* 63.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 63.6 + * 63.7 + * Copyright 2018 Mike Becker. All rights reserved. 63.8 + * 63.9 + * Redistribution and use in source and binary forms, with or without 63.10 + * modification, are permitted provided that the following conditions are met: 63.11 + * 63.12 + * 1. Redistributions of source code must retain the above copyright 63.13 + * notice, this list of conditions and the following disclaimer. 63.14 + * 63.15 + * 2. Redistributions in binary form must reproduce the above copyright 63.16 + * notice, this list of conditions and the following disclaimer in the 63.17 + * documentation and/or other materials provided with the distribution. 63.18 + * 63.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 63.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 63.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 63.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 63.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 63.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 63.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 63.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 63.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 63.29 + * POSSIBILITY OF SUCH DAMAGE. 63.30 + * 63.31 + */ 63.32 +package de.uapcore.lightpit.modules; 63.33 + 63.34 +import de.uapcore.lightpit.LightPITModule; 63.35 +import de.uapcore.lightpit.AbstractLightPITServlet; 63.36 +import de.uapcore.lightpit.HttpMethod; 63.37 +import de.uapcore.lightpit.RequestMapping; 63.38 +import de.uapcore.lightpit.ResponseType; 63.39 +import javax.servlet.annotation.WebServlet; 63.40 +import javax.servlet.http.HttpServletRequest; 63.41 +import javax.servlet.http.HttpServletResponse; 63.42 + 63.43 +/** 63.44 + * Entry point for the application. 63.45 + */ 63.46 +@LightPITModule( 63.47 + bundleBaseName = "localization.home", 63.48 + modulePath = "home" 63.49 +) 63.50 +@WebServlet( 63.51 + name = "HomeModule", 63.52 + urlPatterns = "/home/*" 63.53 +) 63.54 +public final class HomeModule extends AbstractLightPITServlet { 63.55 + 63.56 + @RequestMapping(method = HttpMethod.GET) 63.57 + public ResponseType handle(HttpServletRequest req, HttpServletResponse resp) { 63.58 + 63.59 + return ResponseType.HTML_FULL; 63.60 + } 63.61 +}
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 64.2 +++ b/src/main/java/de/uapcore/lightpit/modules/LanguageModule.java Sat May 09 14:26:31 2020 +0200 64.3 @@ -0,0 +1,118 @@ 64.4 +/* 64.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 64.6 + * 64.7 + * Copyright 2018 Mike Becker. All rights reserved. 64.8 + * 64.9 + * Redistribution and use in source and binary forms, with or without 64.10 + * modification, are permitted provided that the following conditions are met: 64.11 + * 64.12 + * 1. Redistributions of source code must retain the above copyright 64.13 + * notice, this list of conditions and the following disclaimer. 64.14 + * 64.15 + * 2. Redistributions in binary form must reproduce the above copyright 64.16 + * notice, this list of conditions and the following disclaimer in the 64.17 + * documentation and/or other materials provided with the distribution. 64.18 + * 64.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 64.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 64.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 64.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 64.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 64.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 64.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 64.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 64.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 64.29 + * POSSIBILITY OF SUCH DAMAGE. 64.30 + * 64.31 + */ 64.32 +package de.uapcore.lightpit.modules; 64.33 + 64.34 +import de.uapcore.lightpit.LightPITModule; 64.35 +import de.uapcore.lightpit.AbstractLightPITServlet; 64.36 +import de.uapcore.lightpit.Constants; 64.37 +import de.uapcore.lightpit.Functions; 64.38 +import de.uapcore.lightpit.HttpMethod; 64.39 +import javax.servlet.annotation.WebServlet; 64.40 +import javax.servlet.http.HttpServletRequest; 64.41 +import javax.servlet.http.HttpServletResponse; 64.42 +import de.uapcore.lightpit.RequestMapping; 64.43 +import de.uapcore.lightpit.ResponseType; 64.44 +import java.util.ArrayList; 64.45 +import java.util.IllformedLocaleException; 64.46 +import java.util.List; 64.47 +import java.util.Locale; 64.48 +import java.util.Optional; 64.49 +import javax.servlet.ServletException; 64.50 +import org.slf4j.Logger; 64.51 +import org.slf4j.LoggerFactory; 64.52 + 64.53 + 64.54 +@LightPITModule( 64.55 + bundleBaseName = "localization.language", 64.56 + modulePath = "language" 64.57 +) 64.58 +@WebServlet( 64.59 + name = "LanguageModule", 64.60 + urlPatterns = "/language/*" 64.61 +) 64.62 +public final class LanguageModule extends AbstractLightPITServlet { 64.63 + 64.64 + private static final Logger LOG = LoggerFactory.getLogger(LanguageModule.class); 64.65 + 64.66 + private final List<Locale> languages = new ArrayList<>(); 64.67 + 64.68 + @Override 64.69 + public void init() throws ServletException { 64.70 + super.init(); 64.71 + 64.72 + Optional<String[]> langs = Functions.availableLanguages(getServletContext()); 64.73 + if (langs.isPresent()) { 64.74 + for (String lang : langs.get()) { 64.75 + try { 64.76 + Locale locale = Locale.forLanguageTag(lang); 64.77 + if (locale.getLanguage().isEmpty()) { 64.78 + throw new IllformedLocaleException(); 64.79 + } 64.80 + languages.add(locale); 64.81 + } catch (IllformedLocaleException ex) { 64.82 + LOG.warn("Specified lanaguge {} in context parameter cannot be mapped to an existing locale - skipping.", lang); 64.83 + } 64.84 + } 64.85 + 64.86 + } else { 64.87 + languages.add(Locale.ENGLISH); 64.88 + LOG.warn("Context parameter 'available-languges' not found. Only english will be available."); 64.89 + } 64.90 + } 64.91 + 64.92 + @Override 64.93 + public void destroy() { 64.94 + super.destroy(); 64.95 + languages.clear(); 64.96 + } 64.97 + 64.98 + @RequestMapping(method = HttpMethod.GET) 64.99 + public ResponseType handle(HttpServletRequest req, HttpServletResponse resp) { 64.100 + 64.101 + req.setAttribute("languages", languages); 64.102 + req.setAttribute("browserLanguage", req.getLocale()); 64.103 + 64.104 + setStylesheet(req, "language"); 64.105 + setDynamicFragment(req, "language"); 64.106 + return ResponseType.HTML_FULL; 64.107 + } 64.108 + 64.109 + @RequestMapping(method = HttpMethod.POST) 64.110 + public ResponseType switchLanguage(HttpServletRequest req, HttpServletResponse resp) { 64.111 + 64.112 + Optional<Locale> chosenLanguage = Optional.ofNullable(req.getParameter("language")) 64.113 + .map(Locale::forLanguageTag) 64.114 + .filter((l) -> !l.getLanguage().isEmpty()); 64.115 + 64.116 + chosenLanguage.ifPresent((l) -> req.getSession().setAttribute(Constants.SESSION_ATTR_LANGUAGE, l)); 64.117 + chosenLanguage.ifPresent(resp::setLocale); 64.118 + 64.119 + return handle(req, resp); 64.120 + } 64.121 +}
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 65.2 +++ b/src/main/java/de/uapcore/lightpit/modules/ModuleManagerModule.java Sat May 09 14:26:31 2020 +0200 65.3 @@ -0,0 +1,94 @@ 65.4 +/* 65.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 65.6 + * 65.7 + * Copyright 2018 Mike Becker. All rights reserved. 65.8 + * 65.9 + * Redistribution and use in source and binary forms, with or without 65.10 + * modification, are permitted provided that the following conditions are met: 65.11 + * 65.12 + * 1. Redistributions of source code must retain the above copyright 65.13 + * notice, this list of conditions and the following disclaimer. 65.14 + * 65.15 + * 2. Redistributions in binary form must reproduce the above copyright 65.16 + * notice, this list of conditions and the following disclaimer in the 65.17 + * documentation and/or other materials provided with the distribution. 65.18 + * 65.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 65.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 65.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 65.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 65.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 65.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 65.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 65.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 65.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 65.29 + * POSSIBILITY OF SUCH DAMAGE. 65.30 + * 65.31 + */ 65.32 +package de.uapcore.lightpit.modules; 65.33 + 65.34 +import de.uapcore.lightpit.LightPITModule; 65.35 +import de.uapcore.lightpit.AbstractLightPITServlet; 65.36 +import de.uapcore.lightpit.HttpMethod; 65.37 +import de.uapcore.lightpit.LightPITModule.ELProxy; 65.38 +import de.uapcore.lightpit.RequestMapping; 65.39 +import de.uapcore.lightpit.ResponseType; 65.40 +import de.uapcore.lightpit.entities.CoreDAOFactory; 65.41 +import de.uapcore.lightpit.entities.Module; 65.42 +import java.io.IOException; 65.43 +import java.sql.Connection; 65.44 +import java.sql.SQLException; 65.45 +import java.util.List; 65.46 +import java.util.Map; 65.47 +import java.util.Optional; 65.48 +import javax.servlet.annotation.WebServlet; 65.49 +import javax.servlet.http.HttpServletRequest; 65.50 +import javax.servlet.http.HttpServletResponse; 65.51 +import javax.sql.DataSource; 65.52 +import org.slf4j.Logger; 65.53 +import org.slf4j.LoggerFactory; 65.54 + 65.55 +/** 65.56 + * Entry point for the application. 65.57 + */ 65.58 +@LightPITModule( 65.59 + bundleBaseName = "localization.modmgmt", 65.60 + modulePath = "modmgmt" 65.61 +) 65.62 +@WebServlet( 65.63 + name = "ModuleManagerModule", 65.64 + urlPatterns = "/modmgmt/*" 65.65 +) 65.66 +public final class ModuleManagerModule extends AbstractLightPITServlet { 65.67 + 65.68 + private static final Logger LOG = LoggerFactory.getLogger(ModuleManagerModule.class); 65.69 + 65.70 + private static final String REQ_ATTR_MODULES = "modules"; 65.71 + 65.72 + 65.73 + @RequestMapping(method = HttpMethod.GET) 65.74 + public ResponseType handle(HttpServletRequest req, HttpServletResponse resp) throws IOException { 65.75 + 65.76 + Optional<DataSource> ds = getDatabaseFacade().getDataSource(); 65.77 + if (ds.isPresent()) { 65.78 + try (Connection conn = ds.get().getConnection()) { 65.79 + final List<Module> modules = CoreDAOFactory.getModuleDao(getDatabaseFacade().getSQLDialect()).listAll(conn); 65.80 + 65.81 + final Map<String, LightPITModule> registeredModules = getModuleManager().getRegisteredModules(); 65.82 + modules.forEach((mod) -> mod.setAnnotatedInfos(ELProxy.convert(registeredModules.get(mod.getClassname())))); 65.83 + 65.84 + req.setAttribute(REQ_ATTR_MODULES, modules); 65.85 + setDynamicFragment(req, "modules"); 65.86 + return ResponseType.HTML_FULL; 65.87 + } catch (SQLException ex) { 65.88 + LOG.error("Unexpected SQL Exception", ex); 65.89 + resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 65.90 + return ResponseType.NONE; 65.91 + } 65.92 + } else { 65.93 + resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 65.94 + return ResponseType.NONE; 65.95 + } 65.96 + } 65.97 +}
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 66.2 +++ b/src/main/java/de/uapcore/lightpit/modules/VersionsModule.java Sat May 09 14:26:31 2020 +0200 66.3 @@ -0,0 +1,55 @@ 66.4 +/* 66.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 66.6 + * 66.7 + * Copyright 2018 Mike Becker. All rights reserved. 66.8 + * 66.9 + * Redistribution and use in source and binary forms, with or without 66.10 + * modification, are permitted provided that the following conditions are met: 66.11 + * 66.12 + * 1. Redistributions of source code must retain the above copyright 66.13 + * notice, this list of conditions and the following disclaimer. 66.14 + * 66.15 + * 2. Redistributions in binary form must reproduce the above copyright 66.16 + * notice, this list of conditions and the following disclaimer in the 66.17 + * documentation and/or other materials provided with the distribution. 66.18 + * 66.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 66.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 66.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 66.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 66.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 66.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 66.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 66.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 66.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 66.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 66.29 + * POSSIBILITY OF SUCH DAMAGE. 66.30 + * 66.31 + */ 66.32 +package de.uapcore.lightpit.modules; 66.33 + 66.34 +import de.uapcore.lightpit.LightPITModule; 66.35 +import de.uapcore.lightpit.AbstractLightPITServlet; 66.36 +import de.uapcore.lightpit.HttpMethod; 66.37 +import de.uapcore.lightpit.RequestMapping; 66.38 +import de.uapcore.lightpit.ResponseType; 66.39 +import javax.servlet.annotation.WebServlet; 66.40 +import javax.servlet.http.HttpServletRequest; 66.41 +import javax.servlet.http.HttpServletResponse; 66.42 + 66.43 + 66.44 +@LightPITModule( 66.45 + bundleBaseName = "localization.versions", 66.46 + modulePath = "versions" 66.47 +) 66.48 +@WebServlet( 66.49 + name = "VersionsModule", 66.50 + urlPatterns = "/versions/*" 66.51 +) 66.52 +public final class VersionsModule extends AbstractLightPITServlet { 66.53 + @RequestMapping(method = HttpMethod.GET) 66.54 + public ResponseType handle(HttpServletRequest req, HttpServletResponse resp) { 66.55 + 66.56 + return ResponseType.HTML_FULL; 66.57 + } 66.58 +}
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 67.2 +++ b/src/main/java/log4j2.properties Sat May 09 14:26:31 2020 +0200 67.3 @@ -0,0 +1,36 @@ 67.4 +# Copyright 2018 Mike Becker. All rights reserved. 67.5 +# 67.6 +# Redistribution and use in source and binary forms, with or without 67.7 +# modification, are permitted provided that the following conditions are met: 67.8 +# 67.9 +# 1. Redistributions of source code must retain the above copyright 67.10 +# notice, this list of conditions and the following disclaimer. 67.11 +# 67.12 +# 2. Redistributions in binary form must reproduce the above copyright 67.13 +# notice, this list of conditions and the following disclaimer in the 67.14 +# documentation and/or other materials provided with the distribution. 67.15 +# 67.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 67.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 67.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 67.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 67.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 67.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 67.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 67.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 67.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 67.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 67.26 + 67.27 + 67.28 +status = warn 67.29 +dest = err 67.30 +name = LightPITLoggingConfig 67.31 + 67.32 +appender.console.type = Console 67.33 +appender.console.name = STDOUT 67.34 +appender.console.layout.type = PatternLayout 67.35 +appender.console.layout.pattern = %d{ISO8601} [%highlight{%p}] %c{1}: %m %n 67.36 + 67.37 +rootLogger.appenderRef.stdout.ref = STDOUT 67.38 + 67.39 +rootLogger.level = debug
68.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 68.2 +++ b/src/main/resources/META-INF/context.xml Sat May 09 14:26:31 2020 +0200 68.3 @@ -0,0 +1,6 @@ 68.4 +<?xml version="1.0" encoding="UTF-8"?> 68.5 +<Context path="/lightpit"> 68.6 + <ResourceLink name="jdbc/lightpit/app" 68.7 + global="jdbc/lightpit/app" 68.8 + type="javax.sql.DataSource" /> 68.9 +</Context>
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 69.2 +++ b/src/main/resources/localization/error.properties Sat May 09 14:26:31 2020 +0200 69.3 @@ -0,0 +1,35 @@ 69.4 +# Copyright 2018 Mike Becker. All rights reserved. 69.5 +# 69.6 +# Redistribution and use in source and binary forms, with or without 69.7 +# modification, are permitted provided that the following conditions are met: 69.8 +# 69.9 +# 1. Redistributions of source code must retain the above copyright 69.10 +# notice, this list of conditions and the following disclaimer. 69.11 +# 69.12 +# 2. Redistributions in binary form must reproduce the above copyright 69.13 +# notice, this list of conditions and the following disclaimer in the 69.14 +# documentation and/or other materials provided with the distribution. 69.15 +# 69.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 69.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 69.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 69.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 69.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 69.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 69.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 69.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 69.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 69.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 69.26 + 69.27 +title = Error 69.28 + 69.29 +h1 = The requested page cannot be displayed. 69.30 +errorCode = Code 69.31 + 69.32 +errorMessage = Message 69.33 +errorMessage.404 = Page not found 69.34 +errorMessage.403 = Access denied 69.35 +errorMessage.500 = Internal error 69.36 + 69.37 +errorTimestamp = Timestamp 69.38 +errorExceptionText = Internal Exception
70.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 70.2 +++ b/src/main/resources/localization/error_de.properties Sat May 09 14:26:31 2020 +0200 70.3 @@ -0,0 +1,35 @@ 70.4 +# Copyright 2018 Mike Becker. All rights reserved. 70.5 +# 70.6 +# Redistribution and use in source and binary forms, with or without 70.7 +# modification, are permitted provided that the following conditions are met: 70.8 +# 70.9 +# 1. Redistributions of source code must retain the above copyright 70.10 +# notice, this list of conditions and the following disclaimer. 70.11 +# 70.12 +# 2. Redistributions in binary form must reproduce the above copyright 70.13 +# notice, this list of conditions and the following disclaimer in the 70.14 +# documentation and/or other materials provided with the distribution. 70.15 +# 70.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 70.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 70.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 70.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 70.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 70.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 70.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 70.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 70.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 70.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 70.26 + 70.27 +title = Fehler 70.28 + 70.29 +h1 = Die angeforderte Seite kann nicht angezeigt werden. 70.30 +errorCode = Fehlercode 70.31 + 70.32 +errorMessage = Nachricht 70.33 +errorMessage.404 = Seite nicht gefunden 70.34 +errorMessage.403 = Zugriff verboten 70.35 +errorMessage.500 = Interner Fehler 70.36 + 70.37 +errorTimestamp = Zeitstempel 70.38 +errorExceptionText = Interne Ausnahme
71.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 71.2 +++ b/src/main/resources/localization/home.properties Sat May 09 14:26:31 2020 +0200 71.3 @@ -0,0 +1,26 @@ 71.4 +# Copyright 2018 Mike Becker. All rights reserved. 71.5 +# 71.6 +# Redistribution and use in source and binary forms, with or without 71.7 +# modification, are permitted provided that the following conditions are met: 71.8 +# 71.9 +# 1. Redistributions of source code must retain the above copyright 71.10 +# notice, this list of conditions and the following disclaimer. 71.11 +# 71.12 +# 2. Redistributions in binary form must reproduce the above copyright 71.13 +# notice, this list of conditions and the following disclaimer in the 71.14 +# documentation and/or other materials provided with the distribution. 71.15 +# 71.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 71.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 71.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 71.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 71.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 71.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 71.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 71.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 71.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 71.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 71.26 + 71.27 +name = Home Page 71.28 +description = The default page that is displayed when visiting the site. 71.29 +menuLabel = Home
72.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 72.2 +++ b/src/main/resources/localization/home_de.properties Sat May 09 14:26:31 2020 +0200 72.3 @@ -0,0 +1,26 @@ 72.4 +# Copyright 2018 Mike Becker. All rights reserved. 72.5 +# 72.6 +# Redistribution and use in source and binary forms, with or without 72.7 +# modification, are permitted provided that the following conditions are met: 72.8 +# 72.9 +# 1. Redistributions of source code must retain the above copyright 72.10 +# notice, this list of conditions and the following disclaimer. 72.11 +# 72.12 +# 2. Redistributions in binary form must reproduce the above copyright 72.13 +# notice, this list of conditions and the following disclaimer in the 72.14 +# documentation and/or other materials provided with the distribution. 72.15 +# 72.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 72.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 72.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 72.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 72.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 72.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 72.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 72.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 72.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 72.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 72.26 + 72.27 +name = Startseite 72.28 +description = Die Seite, die dem Benutzer standardm\u00e4\u00dfig beim Besuch angezeigt wird. 72.29 +menuLabel = Startseite
73.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 73.2 +++ b/src/main/resources/localization/language.properties Sat May 09 14:26:31 2020 +0200 73.3 @@ -0,0 +1,30 @@ 73.4 +# Copyright 2018 Mike Becker. All rights reserved. 73.5 +# 73.6 +# Redistribution and use in source and binary forms, with or without 73.7 +# modification, are permitted provided that the following conditions are met: 73.8 +# 73.9 +# 1. Redistributions of source code must retain the above copyright 73.10 +# notice, this list of conditions and the following disclaimer. 73.11 +# 73.12 +# 2. Redistributions in binary form must reproduce the above copyright 73.13 +# notice, this list of conditions and the following disclaimer in the 73.14 +# documentation and/or other materials provided with the distribution. 73.15 +# 73.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 73.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 73.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 73.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 73.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 73.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 73.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 73.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 73.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 73.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 73.26 + 73.27 +name = Language Selector 73.28 +description = Where the user can choose his / her language setting. 73.29 +menuLabel = Languages 73.30 + 73.31 +submit = Switch language 73.32 +browserLanguage = Browser language 73.33 +browserLanguageNotAvailable = Browser language not available.
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 74.2 +++ b/src/main/resources/localization/language_de.properties Sat May 09 14:26:31 2020 +0200 74.3 @@ -0,0 +1,31 @@ 74.4 +# Copyright 2018 Mike Becker. All rights reserved. 74.5 +# 74.6 +# Redistribution and use in source and binary forms, with or without 74.7 +# modification, are permitted provided that the following conditions are met: 74.8 +# 74.9 +# 1. Redistributions of source code must retain the above copyright 74.10 +# notice, this list of conditions and the following disclaimer. 74.11 +# 74.12 +# 2. Redistributions in binary form must reproduce the above copyright 74.13 +# notice, this list of conditions and the following disclaimer in the 74.14 +# documentation and/or other materials provided with the distribution. 74.15 +# 74.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 74.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 74.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 74.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 74.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 74.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 74.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 74.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 74.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 74.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 74.26 + 74.27 +name = Sprachauswahl 74.28 +description = Hier kann der Benutzer die Sprache f\u00fcr die Website ausw\u00e4hlen. 74.29 + 74.30 +menuLabel = Sprache 74.31 + 74.32 +submit = Sprache ausw\u00e4hlen 74.33 +browserLanguage = Browsersprache 74.34 +browserLanguageNotAvailable = Browsersprache nicht verf\u00fcgbar.
75.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 75.2 +++ b/src/main/resources/localization/modmgmt.properties Sat May 09 14:26:31 2020 +0200 75.3 @@ -0,0 +1,36 @@ 75.4 +# Copyright 2018 Mike Becker. All rights reserved. 75.5 +# 75.6 +# Redistribution and use in source and binary forms, with or without 75.7 +# modification, are permitted provided that the following conditions are met: 75.8 +# 75.9 +# 1. Redistributions of source code must retain the above copyright 75.10 +# notice, this list of conditions and the following disclaimer. 75.11 +# 75.12 +# 2. Redistributions in binary form must reproduce the above copyright 75.13 +# notice, this list of conditions and the following disclaimer in the 75.14 +# documentation and/or other materials provided with the distribution. 75.15 +# 75.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 75.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 75.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 75.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 75.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 75.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 75.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 75.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 75.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 75.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 75.26 + 75.27 +name = Module Management 75.28 +description = Configure the visible LightPIT modules and the required access powers. 75.29 +menuLabel = Modules 75.30 + 75.31 +section.modlist.title = List of Modules 75.32 + 75.33 +caption.module = Module 75.34 +caption.path = Path 75.35 +caption.desc = Description 75.36 +caption.active = Active 75.37 +caption.class = Class 75.38 +caption.bundle = Resource Bundle 75.39 +
76.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 76.2 +++ b/src/main/resources/localization/modmgmt_de.properties Sat May 09 14:26:31 2020 +0200 76.3 @@ -0,0 +1,35 @@ 76.4 +# Copyright 2018 Mike Becker. All rights reserved. 76.5 +# 76.6 +# Redistribution and use in source and binary forms, with or without 76.7 +# modification, are permitted provided that the following conditions are met: 76.8 +# 76.9 +# 1. Redistributions of source code must retain the above copyright 76.10 +# notice, this list of conditions and the following disclaimer. 76.11 +# 76.12 +# 2. Redistributions in binary form must reproduce the above copyright 76.13 +# notice, this list of conditions and the following disclaimer in the 76.14 +# documentation and/or other materials provided with the distribution. 76.15 +# 76.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 76.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 76.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 76.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 76.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 76.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 76.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 76.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 76.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 76.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 76.26 + 76.27 +name = Modulverwaltung 76.28 +description = Konfiguration der sichtbaren LightPIT Module und deren Zugriffsrechte. 76.29 +menuLabel = Module 76.30 + 76.31 +section.modlist.title = Liste der Module 76.32 + 76.33 +caption.module = Modul 76.34 +caption.path = Pfad 76.35 +caption.desc = Beschreibung 76.36 +caption.active = Aktiv 76.37 +caption.class = Klasse 76.38 +caption.bundle = Ressourcen-Datei
77.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 77.2 +++ b/src/main/resources/localization/versions.properties Sat May 09 14:26:31 2020 +0200 77.3 @@ -0,0 +1,26 @@ 77.4 +# Copyright 2018 Mike Becker. All rights reserved. 77.5 +# 77.6 +# Redistribution and use in source and binary forms, with or without 77.7 +# modification, are permitted provided that the following conditions are met: 77.8 +# 77.9 +# 1. Redistributions of source code must retain the above copyright 77.10 +# notice, this list of conditions and the following disclaimer. 77.11 +# 77.12 +# 2. Redistributions in binary form must reproduce the above copyright 77.13 +# notice, this list of conditions and the following disclaimer in the 77.14 +# documentation and/or other materials provided with the distribution. 77.15 +# 77.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 77.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 77.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 77.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 77.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 77.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 77.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 77.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 77.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 77.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 77.26 + 77.27 +name = Version Management 77.28 +description = Allows the configuration of versions and milestones within your project. 77.29 +menuLabel = Versions
78.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 78.2 +++ b/src/main/resources/localization/versions_de.properties Sat May 09 14:26:31 2020 +0200 78.3 @@ -0,0 +1,26 @@ 78.4 +# Copyright 2018 Mike Becker. All rights reserved. 78.5 +# 78.6 +# Redistribution and use in source and binary forms, with or without 78.7 +# modification, are permitted provided that the following conditions are met: 78.8 +# 78.9 +# 1. Redistributions of source code must retain the above copyright 78.10 +# notice, this list of conditions and the following disclaimer. 78.11 +# 78.12 +# 2. Redistributions in binary form must reproduce the above copyright 78.13 +# notice, this list of conditions and the following disclaimer in the 78.14 +# documentation and/or other materials provided with the distribution. 78.15 +# 78.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 78.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 78.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 78.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 78.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 78.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 78.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 78.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 78.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 78.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 78.26 + 78.27 +name = Versionsverwaltung 78.28 +description = Erlaubt die Konfiguration von Versionen und Meilensteinen im Projekt. 78.29 +menuLabel = Versionen
79.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 79.2 +++ b/src/main/webapp/WEB-INF/dynamic_fragments/error.jsp Sat May 09 14:26:31 2020 +0200 79.3 @@ -0,0 +1,56 @@ 79.4 +<%-- 79.5 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 79.6 + 79.7 +Copyright 2018 Mike Becker. All rights reserved. 79.8 + 79.9 +Redistribution and use in source and binary forms, with or without 79.10 +modification, are permitted provided that the following conditions are met: 79.11 + 79.12 +1. Redistributions of source code must retain the above copyright 79.13 +notice, this list of conditions and the following disclaimer. 79.14 + 79.15 +2. Redistributions in binary form must reproduce the above copyright 79.16 +notice, this list of conditions and the following disclaimer in the 79.17 +documentation and/or other materials provided with the distribution. 79.18 + 79.19 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 79.20 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 79.21 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 79.22 +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 79.23 +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 79.24 +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 79.25 +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 79.26 +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 79.27 +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 79.28 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 79.29 +--%> 79.30 +<%@page pageEncoding="UTF-8" session="true" %> 79.31 +<%@page import="de.uapcore.lightpit.modules.ErrorModule" %> 79.32 +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 79.33 +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 79.34 + 79.35 +<c:set scope="page" var="errorCode" value="${requestScope[ErrorModule.REQ_ATTR_ERROR_CODE]}"/> 79.36 + 79.37 +<div id="error-page"> 79.38 + <h1><fmt:message key="h1"/></h1> 79.39 + <table> 79.40 + <tr> 79.41 + <th><fmt:message key="errorCode" />:</th> 79.42 + <td>${errorCode}</td> 79.43 + </tr> 79.44 + <tr> 79.45 + <th><fmt:message key="errorMessage" />:</th> 79.46 + <td><fmt:message key="errorMessage.${errorCode}" /></td> 79.47 + </tr> 79.48 + <tr> 79.49 + <th><fmt:message key="errorTimestamp" />:</th> 79.50 + <td><fmt:formatDate type="both" value="<%= new java.util.Date()%>"/></td> 79.51 + </tr> 79.52 + <c:if test="${not empty exception}"> 79.53 + <tr> 79.54 + <th><fmt:message key="errorExceptionText" />:</th> 79.55 + <td>${exception.class.name} - ${exception.message}</td> 79.56 + </tr> 79.57 + </c:if> 79.58 + </table> 79.59 +</div>
80.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 80.2 +++ b/src/main/webapp/WEB-INF/dynamic_fragments/language.jsp Sat May 09 14:26:31 2020 +0200 80.3 @@ -0,0 +1,47 @@ 80.4 +<%-- 80.5 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 80.6 + 80.7 +Copyright 2018 Mike Becker. All rights reserved. 80.8 + 80.9 +Redistribution and use in source and binary forms, with or without 80.10 +modification, are permitted provided that the following conditions are met: 80.11 + 80.12 +1. Redistributions of source code must retain the above copyright 80.13 +notice, this list of conditions and the following disclaimer. 80.14 + 80.15 +2. Redistributions in binary form must reproduce the above copyright 80.16 +notice, this list of conditions and the following disclaimer in the 80.17 +documentation and/or other materials provided with the distribution. 80.18 + 80.19 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 80.20 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 80.21 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 80.22 +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 80.23 +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 80.24 +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 80.25 +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 80.26 +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 80.27 +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 80.28 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 80.29 +--%> 80.30 +<%@page pageEncoding="UTF-8" session="true" %> 80.31 +<%@page import="de.uapcore.lightpit.Constants" %> 80.32 +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 80.33 +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 80.34 + 80.35 +<c:set scope="page" var="currentLanguage" value="${sessionScope[Constants.SESSION_ATTR_LANGUAGE]}" /> 80.36 + 80.37 +<form method="POST"id="lang-selector"> 80.38 + <c:forEach items="${languages}" var="l"> 80.39 + <label> 80.40 + <input type="radio" name="language" value="${l.language}" 80.41 + <c:if test="${l.language eq currentLanguage.language}">checked</c:if>/> 80.42 + ${l.displayLanguage} 80.43 + (${l.getDisplayLanguage(currentLanguage)}<c:if test="${not empty browserLanguage and l.language eq browserLanguage.language}"><c:set var="browserLanguagePresent" value="true"/> - <fmt:message key="browserLanguage"/></c:if>) 80.44 + </label> 80.45 + </c:forEach> 80.46 + <c:if test="${not browserLanguagePresent}"> 80.47 + <span class="blNA"><fmt:message key="browserLanguageNotAvailable" /></span> 80.48 + </c:if> 80.49 + <input type="submit" value="<fmt:message key="submit" />"/> 80.50 +</form>
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 81.2 +++ b/src/main/webapp/WEB-INF/dynamic_fragments/modules.jsp Sat May 09 14:26:31 2020 +0200 81.3 @@ -0,0 +1,54 @@ 81.4 +<%-- 81.5 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 81.6 + 81.7 +Copyright 2018 Mike Becker. All rights reserved. 81.8 + 81.9 +Redistribution and use in source and binary forms, with or without 81.10 +modification, are permitted provided that the following conditions are met: 81.11 + 81.12 +1. Redistributions of source code must retain the above copyright 81.13 +notice, this list of conditions and the following disclaimer. 81.14 + 81.15 +2. Redistributions in binary form must reproduce the above copyright 81.16 +notice, this list of conditions and the following disclaimer in the 81.17 +documentation and/or other materials provided with the distribution. 81.18 + 81.19 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 81.20 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 81.21 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 81.22 +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 81.23 +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 81.24 +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 81.25 +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 81.26 +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 81.27 +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 81.28 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 81.29 +--%> 81.30 +<%@page pageEncoding="UTF-8" session="true" %> 81.31 +<%@page import="de.uapcore.lightpit.Constants" %> 81.32 +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 81.33 +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 81.34 + 81.35 +<h2><fmt:message key="section.modlist.title"/></h2> 81.36 +<table class="datatable"> 81.37 + <tr> 81.38 + <th class="hcenter"><fmt:message key="caption.active" /></th> 81.39 + <th><fmt:message key="caption.module" /></th> 81.40 + <th><fmt:message key="caption.path" /></th> 81.41 + <th><fmt:message key="caption.desc" /></th> 81.42 + <th><fmt:message key="caption.class" /></th> 81.43 + <th><fmt:message key="caption.bundle" /></th> 81.44 + </tr> 81.45 + <c:forEach items="${modules}" var="module"> 81.46 + <tr> 81.47 + <td class="hcenter">${module.visible}</td> 81.48 + <fmt:bundle basename="${module.annotatedInfos.bundleBaseName}"> 81.49 + <td class="nowrap"><fmt:message key="${module.annotatedInfos.nameKey}" /></td> 81.50 + <td>/${module.annotatedInfos.modulePath}</td> 81.51 + <td><fmt:message key="${module.annotatedInfos.descKey}" /></td> 81.52 + <td class="smalltext">${module.classname}</td> 81.53 + <td class="smalltext">${module.annotatedInfos.bundleBaseName}</td> 81.54 + </fmt:bundle> 81.55 + </tr> 81.56 + </c:forEach> 81.57 +</table> 81.58 \ No newline at end of file
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 82.2 +++ b/src/main/webapp/WEB-INF/jsp/html_full.jsp Sat May 09 14:26:31 2020 +0200 82.3 @@ -0,0 +1,91 @@ 82.4 +<%-- 82.5 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 82.6 + 82.7 +Copyright 2018 Mike Becker. All rights reserved. 82.8 + 82.9 +Redistribution and use in source and binary forms, with or without 82.10 +modification, are permitted provided that the following conditions are met: 82.11 + 82.12 +1. Redistributions of source code must retain the above copyright 82.13 +notice, this list of conditions and the following disclaimer. 82.14 + 82.15 +2. Redistributions in binary form must reproduce the above copyright 82.16 +notice, this list of conditions and the following disclaimer in the 82.17 +documentation and/or other materials provided with the distribution. 82.18 + 82.19 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 82.20 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 82.21 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 82.22 +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 82.23 +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 82.24 +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 82.25 +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 82.26 +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 82.27 +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 82.28 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 82.29 +--%> 82.30 +<%@page contentType="text/html" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" session="true" %> 82.31 +<%@page import="de.uapcore.lightpit.Constants" %> 82.32 +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 82.33 +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 82.34 +<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 82.35 + 82.36 +<%-- Define an alias for the main menu --%> 82.37 +<c:set scope="page" var="mainMenu" value="${requestScope[Constants.REQ_ATTR_MENU]}"/> 82.38 + 82.39 +<%-- Define an alias for the fragment name --%> 82.40 +<c:set scope="page" var="fragment" value="${requestScope[Constants.REQ_ATTR_FRAGMENT]}"/> 82.41 + 82.42 +<%-- Define an alias for the additional stylesheet --%> 82.43 +<c:set scope="page" var="extraCss" value="${requestScope[Constants.REQ_ATTR_STYLESHEET]}"/> 82.44 + 82.45 +<%-- Define an alias for the module info --%> 82.46 +<c:set scope="page" var="moduleInfo" value="${requestScope[Constants.REQ_ATTR_MODULE_INFO]}"/> 82.47 + 82.48 +<%-- Apply the session locale (should always be present, but check nevertheless) --%> 82.49 +<c:if test="${not empty sessionScope[Constants.SESSION_ATTR_LANGUAGE]}"> 82.50 +<fmt:setLocale scope="request" value="${sessionScope[Constants.SESSION_ATTR_LANGUAGE]}"/> 82.51 +</c:if> 82.52 + 82.53 +<!DOCTYPE html> 82.54 +<html> 82.55 + <head> 82.56 + <base href="${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/"> 82.57 + <title>LightPIT - 82.58 + <fmt:bundle basename="${moduleInfo.bundleBaseName}"> 82.59 + <fmt:message key="${moduleInfo.titleKey}" /> 82.60 + </fmt:bundle> 82.61 + </title> 82.62 + <meta charset="UTF-8"> 82.63 + <link rel="stylesheet" href="lightpit.css" type="text/css"> 82.64 + <c:if test="${not empty extraCss}"> 82.65 + <link rel="stylesheet" href="${extraCss}" type="text/css"> 82.66 + </c:if> 82.67 + </head> 82.68 + <body> 82.69 + <div id="mainMenu"> 82.70 + <c:forEach var="menu" items="${mainMenu}"> 82.71 + <div class="menuEntry" 82.72 + <c:if test="${requestScope[Constants.REQ_ATTR_MODULE_CLASSNAME] eq menu.moduleClassName}"> 82.73 + data-active 82.74 + </c:if> 82.75 + > 82.76 + <a href="${menu.pathName}"> 82.77 + <fmt:bundle basename="${menu.resourceKey.bundle}"> 82.78 + <fmt:message key="${menu.resourceKey.key}" /> 82.79 + </fmt:bundle> 82.80 + </a> 82.81 + </div> 82.82 + </c:forEach> 82.83 + </div> 82.84 + <div id="subMenu"> 82.85 + 82.86 + </div> 82.87 + <div id="content-area"> 82.88 + <c:if test="${not empty fragment}"> 82.89 + <fmt:setBundle scope="request" basename="${moduleInfo.bundleBaseName}"/> 82.90 + <c:import url="${fragment}" /> 82.91 + </c:if> 82.92 + </div> 82.93 + </body> 82.94 +</html>
83.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 83.2 +++ b/src/main/webapp/WEB-INF/web.xml Sat May 09 14:26:31 2020 +0200 83.3 @@ -0,0 +1,24 @@ 83.4 +<?xml version="1.0" encoding="UTF-8"?> 83.5 +<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> 83.6 + <session-config> 83.7 + <session-timeout> 83.8 + 30 83.9 + </session-timeout> 83.10 + </session-config> 83.11 + <context-param> 83.12 + <param-name>available-languages</param-name> 83.13 + <param-value>en,de</param-value> 83.14 + </context-param> 83.15 + <error-page> 83.16 + <error-code>404</error-code> 83.17 + <location>/error/404</location> 83.18 + </error-page> 83.19 + <error-page> 83.20 + <error-code>403</error-code> 83.21 + <location>/error/403</location> 83.22 + </error-page> 83.23 + <error-page> 83.24 + <error-code>500</error-code> 83.25 + <location>/error/500</location> 83.26 + </error-page> 83.27 +</web-app>
84.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 84.2 +++ b/src/main/webapp/error.css Sat May 09 14:26:31 2020 +0200 84.3 @@ -0,0 +1,55 @@ 84.4 +/* 84.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 84.6 + * 84.7 + * Copyright 2018 Mike Becker. All rights reserved. 84.8 + * 84.9 + * Redistribution and use in source and binary forms, with or without 84.10 + * modification, are permitted provided that the following conditions are met: 84.11 + * 84.12 + * 1. Redistributions of source code must retain the above copyright 84.13 + * notice, this list of conditions and the following disclaimer. 84.14 + * 84.15 + * 2. Redistributions in binary form must reproduce the above copyright 84.16 + * notice, this list of conditions and the following disclaimer in the 84.17 + * documentation and/or other materials provided with the distribution. 84.18 + * 84.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 84.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 84.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 84.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 84.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 84.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 84.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 84.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 84.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 84.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 84.29 + * POSSIBILITY OF SUCH DAMAGE. 84.30 + * 84.31 + */ 84.32 + 84.33 +#error-page h1 { 84.34 + font-size: 1.5em; 84.35 +} 84.36 + 84.37 +#error-page table { 84.38 + width: 100%; 84.39 + 84.40 + border-top-style: solid; 84.41 + border-top-width: 1pt; 84.42 + border-top-color: #606060; 84.43 + 84.44 + border-bottom-style: solid; 84.45 + border-bottom-width: 1pt; 84.46 + border-bottom-color: #505050; 84.47 + 84.48 + border-collapse: separate; 84.49 + border-spacing: .5em; 84.50 +} 84.51 + 84.52 +#error-page table th { 84.53 + text-align: right; 84.54 +} 84.55 + 84.56 +#error-page table td { 84.57 + width: 100%; 84.58 +}
85.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 85.2 +++ b/src/main/webapp/index.jsp Sat May 09 14:26:31 2020 +0200 85.3 @@ -0,0 +1,32 @@ 85.4 +<%-- 85.5 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 85.6 + 85.7 +Copyright 2018 Mike Becker. All rights reserved. 85.8 + 85.9 +Redistribution and use in source and binary forms, with or without 85.10 +modification, are permitted provided that the following conditions are met: 85.11 + 85.12 +1. Redistributions of source code must retain the above copyright 85.13 +notice, this list of conditions and the following disclaimer. 85.14 + 85.15 +2. Redistributions in binary form must reproduce the above copyright 85.16 +notice, this list of conditions and the following disclaimer in the 85.17 +documentation and/or other materials provided with the distribution. 85.18 + 85.19 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 85.20 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 85.21 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 85.22 +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 85.23 +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 85.24 +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 85.25 +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 85.26 +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 85.27 +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 85.28 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 85.29 +--%> 85.30 +<%@page import="de.uapcore.lightpit.Functions" %> 85.31 +<%@page import="de.uapcore.lightpit.modules.HomeModule" %> 85.32 +<% 85.33 +response.setStatus(response.SC_MOVED_TEMPORARILY); 85.34 +response.setHeader("Location", "./"+Functions.modulePathOf(HomeModule.class)); 85.35 +%>
86.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 86.2 +++ b/src/main/webapp/language.css Sat May 09 14:26:31 2020 +0200 86.3 @@ -0,0 +1,46 @@ 86.4 +/* 86.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 86.6 + * 86.7 + * Copyright 2018 Mike Becker. All rights reserved. 86.8 + * 86.9 + * Redistribution and use in source and binary forms, with or without 86.10 + * modification, are permitted provided that the following conditions are met: 86.11 + * 86.12 + * 1. Redistributions of source code must retain the above copyright 86.13 + * notice, this list of conditions and the following disclaimer. 86.14 + * 86.15 + * 2. Redistributions in binary form must reproduce the above copyright 86.16 + * notice, this list of conditions and the following disclaimer in the 86.17 + * documentation and/or other materials provided with the distribution. 86.18 + * 86.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 86.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 86.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 86.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 86.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 86.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 86.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 86.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 86.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 86.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 86.29 + * POSSIBILITY OF SUCH DAMAGE. 86.30 + * 86.31 + */ 86.32 + 86.33 +#lang-selector { 86.34 + max-width: 30%; 86.35 + display: flex; 86.36 + flex-basis: content; 86.37 + flex-direction: column; 86.38 +} 86.39 + 86.40 +input { 86.41 + margin: .5em; 86.42 +} 86.43 + 86.44 +span.blNA { 86.45 + margin: .5em; 86.46 + color: red; 86.47 + font-style: italic; 86.48 + font-size: smaller; 86.49 +}
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 87.2 +++ b/src/main/webapp/lightpit.css Sat May 09 14:26:31 2020 +0200 87.3 @@ -0,0 +1,129 @@ 87.4 +/* 87.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 87.6 + * 87.7 + * Copyright 2018 Mike Becker. All rights reserved. 87.8 + * 87.9 + * Redistribution and use in source and binary forms, with or without 87.10 + * modification, are permitted provided that the following conditions are met: 87.11 + * 87.12 + * 1. Redistributions of source code must retain the above copyright 87.13 + * notice, this list of conditions and the following disclaimer. 87.14 + * 87.15 + * 2. Redistributions in binary form must reproduce the above copyright 87.16 + * notice, this list of conditions and the following disclaimer in the 87.17 + * documentation and/or other materials provided with the distribution. 87.18 + * 87.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 87.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 87.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 87.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 87.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 87.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 87.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 87.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 87.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 87.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 87.29 + * POSSIBILITY OF SUCH DAMAGE. 87.30 + * 87.31 + */ 87.32 + 87.33 +html { 87.34 + background: #f8f8f8; 87.35 +} 87.36 + 87.37 +body { 87.38 + background: white; 87.39 + font-family: serif; 87.40 + 87.41 + border-color: #505050; 87.42 + border-style: solid; 87.43 + border-width: 1pt; 87.44 + 87.45 + color: #1c202e; 87.46 +} 87.47 + 87.48 +h1, h2, h3, h4, #mainMenu, #subMenu { 87.49 + font-family: sans-serif; 87.50 +} 87.51 + 87.52 +a { 87.53 + color: #3060f8; 87.54 + text-decoration: none; 87.55 +} 87.56 + 87.57 +#mainMenu { 87.58 + width: 100%; 87.59 + display: flex; 87.60 + flex-flow: row wrap; 87.61 + background: #f0f0f5; 87.62 +} 87.63 + 87.64 +#subMenu { 87.65 + background: #f7f7ff; 87.66 + 87.67 + border-image: linear-gradient(to right, #606060, rgba(60,60,60,.25)); 87.68 + border-image-slice: 1; 87.69 + border-top-style: solid; 87.70 + border-top-width: 1pt; 87.71 + border-bottom-style: solid; 87.72 + border-bottom-width: 1pt; 87.73 +} 87.74 + 87.75 +.menuEntry { 87.76 + padding: .25em 1em .25em 1em; 87.77 + border-right-style: solid; 87.78 + border-right-width: 1pt; 87.79 + border-right-color: #9095a1; 87.80 +} 87.81 + 87.82 +#mainMenu .menuEntry[data-active] { 87.83 + background: #e0e0e5; 87.84 +} 87.85 + 87.86 +#subMenu .menuEntry[data-active] { 87.87 + background: #e7e7ef 87.88 +} 87.89 + 87.90 +#content-area { 87.91 + padding: 1em; 87.92 +} 87.93 + 87.94 +th { 87.95 + text-align: left; 87.96 +} 87.97 + 87.98 +table.datatable { 87.99 + width: 100%; 87.100 + border-style: solid; 87.101 + border-width: 1pt; 87.102 + border-color: black; 87.103 + border-collapse: collapse; 87.104 +} 87.105 + 87.106 +table.datatable th { 87.107 + font-weight: bold; 87.108 + background: lightsteelblue; 87.109 +} 87.110 + 87.111 +table.datatable th, table.datatable td { 87.112 + border-style: solid; 87.113 + border-width: 1pt; 87.114 + border-color: black; 87.115 + padding: .4em; 87.116 +} 87.117 + 87.118 +table.datatable tr:nth-child(2n) { 87.119 + background: lightblue; 87.120 +} 87.121 + 87.122 +.hcenter { 87.123 + text-align: center; 87.124 +} 87.125 + 87.126 +.smalltext { 87.127 + font-size: smaller; 87.128 +} 87.129 + 87.130 +.nowrap { 87.131 + white-space: nowrap; 87.132 +} 87.133 \ No newline at end of file
88.1 --- a/web/META-INF/context.xml Sun Apr 08 16:51:15 2018 +0200 88.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 88.3 @@ -1,6 +0,0 @@ 88.4 -<?xml version="1.0" encoding="UTF-8"?> 88.5 -<Context path="/lightpit"> 88.6 - <ResourceLink name="jdbc/lightpit/app" 88.7 - global="jdbc/lightpit/app" 88.8 - type="javax.sql.DataSource" /> 88.9 -</Context>
89.1 --- a/web/WEB-INF/dynamic_fragments/error.jsp Sun Apr 08 16:51:15 2018 +0200 89.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 89.3 @@ -1,56 +0,0 @@ 89.4 -<%-- 89.5 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 89.6 - 89.7 -Copyright 2018 Mike Becker. All rights reserved. 89.8 - 89.9 -Redistribution and use in source and binary forms, with or without 89.10 -modification, are permitted provided that the following conditions are met: 89.11 - 89.12 -1. Redistributions of source code must retain the above copyright 89.13 -notice, this list of conditions and the following disclaimer. 89.14 - 89.15 -2. Redistributions in binary form must reproduce the above copyright 89.16 -notice, this list of conditions and the following disclaimer in the 89.17 -documentation and/or other materials provided with the distribution. 89.18 - 89.19 -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 89.20 -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 89.21 -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 89.22 -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 89.23 -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 89.24 -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 89.25 -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 89.26 -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 89.27 -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 89.28 -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 89.29 ---%> 89.30 -<%@page pageEncoding="UTF-8" session="true" %> 89.31 -<%@page import="de.uapcore.lightpit.modules.ErrorModule" %> 89.32 -<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 89.33 -<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 89.34 - 89.35 -<c:set scope="page" var="errorCode" value="${requestScope[ErrorModule.REQ_ATTR_ERROR_CODE]}"/> 89.36 - 89.37 -<div id="error-page"> 89.38 - <h1><fmt:message key="h1"/></h1> 89.39 - <table> 89.40 - <tr> 89.41 - <th><fmt:message key="errorCode" />:</th> 89.42 - <td>${errorCode}</td> 89.43 - </tr> 89.44 - <tr> 89.45 - <th><fmt:message key="errorMessage" />:</th> 89.46 - <td><fmt:message key="errorMessage.${errorCode}" /></td> 89.47 - </tr> 89.48 - <tr> 89.49 - <th><fmt:message key="errorTimestamp" />:</th> 89.50 - <td><fmt:formatDate type="both" value="<%= new java.util.Date()%>"/></td> 89.51 - </tr> 89.52 - <c:if test="${not empty exception}"> 89.53 - <tr> 89.54 - <th><fmt:message key="errorExceptionText" />:</th> 89.55 - <td>${exception.class.name} - ${exception.message}</td> 89.56 - </tr> 89.57 - </c:if> 89.58 - </table> 89.59 -</div>
90.1 --- a/web/WEB-INF/dynamic_fragments/language.jsp Sun Apr 08 16:51:15 2018 +0200 90.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 90.3 @@ -1,47 +0,0 @@ 90.4 -<%-- 90.5 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 90.6 - 90.7 -Copyright 2018 Mike Becker. All rights reserved. 90.8 - 90.9 -Redistribution and use in source and binary forms, with or without 90.10 -modification, are permitted provided that the following conditions are met: 90.11 - 90.12 -1. Redistributions of source code must retain the above copyright 90.13 -notice, this list of conditions and the following disclaimer. 90.14 - 90.15 -2. Redistributions in binary form must reproduce the above copyright 90.16 -notice, this list of conditions and the following disclaimer in the 90.17 -documentation and/or other materials provided with the distribution. 90.18 - 90.19 -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 90.20 -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 90.21 -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 90.22 -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 90.23 -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 90.24 -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 90.25 -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 90.26 -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 90.27 -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 90.28 -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 90.29 ---%> 90.30 -<%@page pageEncoding="UTF-8" session="true" %> 90.31 -<%@page import="de.uapcore.lightpit.Constants" %> 90.32 -<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 90.33 -<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 90.34 - 90.35 -<c:set scope="page" var="currentLanguage" value="${sessionScope[Constants.SESSION_ATTR_LANGUAGE]}" /> 90.36 - 90.37 -<form method="POST"id="lang-selector"> 90.38 - <c:forEach items="${languages}" var="l"> 90.39 - <label> 90.40 - <input type="radio" name="language" value="${l.language}" 90.41 - <c:if test="${l.language eq currentLanguage.language}">checked</c:if>/> 90.42 - ${l.displayLanguage} 90.43 - (${l.getDisplayLanguage(currentLanguage)}<c:if test="${not empty browserLanguage and l.language eq browserLanguage.language}"><c:set var="browserLanguagePresent" value="true"/> - <fmt:message key="browserLanguage"/></c:if>) 90.44 - </label> 90.45 - </c:forEach> 90.46 - <c:if test="${not browserLanguagePresent}"> 90.47 - <span class="blNA"><fmt:message key="browserLanguageNotAvailable" /></span> 90.48 - </c:if> 90.49 - <input type="submit" value="<fmt:message key="submit" />"/> 90.50 -</form>
91.1 --- a/web/WEB-INF/dynamic_fragments/modules.jsp Sun Apr 08 16:51:15 2018 +0200 91.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 91.3 @@ -1,54 +0,0 @@ 91.4 -<%-- 91.5 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 91.6 - 91.7 -Copyright 2018 Mike Becker. All rights reserved. 91.8 - 91.9 -Redistribution and use in source and binary forms, with or without 91.10 -modification, are permitted provided that the following conditions are met: 91.11 - 91.12 -1. Redistributions of source code must retain the above copyright 91.13 -notice, this list of conditions and the following disclaimer. 91.14 - 91.15 -2. Redistributions in binary form must reproduce the above copyright 91.16 -notice, this list of conditions and the following disclaimer in the 91.17 -documentation and/or other materials provided with the distribution. 91.18 - 91.19 -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 91.20 -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 91.21 -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 91.22 -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 91.23 -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 91.24 -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 91.25 -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 91.26 -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 91.27 -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 91.28 -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 91.29 ---%> 91.30 -<%@page pageEncoding="UTF-8" session="true" %> 91.31 -<%@page import="de.uapcore.lightpit.Constants" %> 91.32 -<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 91.33 -<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 91.34 - 91.35 -<h2><fmt:message key="section.modlist.title"/></h2> 91.36 -<table class="datatable"> 91.37 - <tr> 91.38 - <th class="hcenter"><fmt:message key="caption.active" /></th> 91.39 - <th><fmt:message key="caption.module" /></th> 91.40 - <th><fmt:message key="caption.path" /></th> 91.41 - <th><fmt:message key="caption.desc" /></th> 91.42 - <th><fmt:message key="caption.class" /></th> 91.43 - <th><fmt:message key="caption.bundle" /></th> 91.44 - </tr> 91.45 - <c:forEach items="${modules}" var="module"> 91.46 - <tr> 91.47 - <td class="hcenter">${module.visible}</td> 91.48 - <fmt:bundle basename="${module.annotatedInfos.bundleBaseName}"> 91.49 - <td class="nowrap"><fmt:message key="${module.annotatedInfos.nameKey}" /></td> 91.50 - <td>/${module.annotatedInfos.modulePath}</td> 91.51 - <td><fmt:message key="${module.annotatedInfos.descKey}" /></td> 91.52 - <td class="smalltext">${module.classname}</td> 91.53 - <td class="smalltext">${module.annotatedInfos.bundleBaseName}</td> 91.54 - </fmt:bundle> 91.55 - </tr> 91.56 - </c:forEach> 91.57 -</table> 91.58 \ No newline at end of file
92.1 --- a/web/WEB-INF/glassfish-web.xml Sun Apr 08 16:51:15 2018 +0200 92.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 92.3 @@ -1,11 +0,0 @@ 92.4 -<?xml version="1.0" encoding="UTF-8"?> 92.5 -<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd"> 92.6 -<glassfish-web-app error-url=""> 92.7 - <context-root>/lightpit</context-root> 92.8 - <class-loader delegate="true"/> 92.9 - <jsp-config> 92.10 - <property name="keepgenerated" value="true"> 92.11 - <description>Keep a copy of the generated servlet class' java code.</description> 92.12 - </property> 92.13 - </jsp-config> 92.14 -</glassfish-web-app>
93.1 --- a/web/WEB-INF/jsp/html_full.jsp Sun Apr 08 16:51:15 2018 +0200 93.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 93.3 @@ -1,91 +0,0 @@ 93.4 -<%-- 93.5 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 93.6 - 93.7 -Copyright 2018 Mike Becker. All rights reserved. 93.8 - 93.9 -Redistribution and use in source and binary forms, with or without 93.10 -modification, are permitted provided that the following conditions are met: 93.11 - 93.12 -1. Redistributions of source code must retain the above copyright 93.13 -notice, this list of conditions and the following disclaimer. 93.14 - 93.15 -2. Redistributions in binary form must reproduce the above copyright 93.16 -notice, this list of conditions and the following disclaimer in the 93.17 -documentation and/or other materials provided with the distribution. 93.18 - 93.19 -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 93.20 -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 93.21 -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 93.22 -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 93.23 -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 93.24 -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 93.25 -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 93.26 -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 93.27 -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 93.28 -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 93.29 ---%> 93.30 -<%@page contentType="text/html" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" session="true" %> 93.31 -<%@page import="de.uapcore.lightpit.Constants" %> 93.32 -<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 93.33 -<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 93.34 -<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 93.35 - 93.36 -<%-- Define an alias for the main menu --%> 93.37 -<c:set scope="page" var="mainMenu" value="${requestScope[Constants.REQ_ATTR_MENU]}"/> 93.38 - 93.39 -<%-- Define an alias for the fragment name --%> 93.40 -<c:set scope="page" var="fragment" value="${requestScope[Constants.REQ_ATTR_FRAGMENT]}"/> 93.41 - 93.42 -<%-- Define an alias for the additional stylesheet --%> 93.43 -<c:set scope="page" var="extraCss" value="${requestScope[Constants.REQ_ATTR_STYLESHEET]}"/> 93.44 - 93.45 -<%-- Define an alias for the module info --%> 93.46 -<c:set scope="page" var="moduleInfo" value="${requestScope[Constants.REQ_ATTR_MODULE_INFO]}"/> 93.47 - 93.48 -<%-- Apply the session locale (should always be present, but check nevertheless) --%> 93.49 -<c:if test="${not empty sessionScope[Constants.SESSION_ATTR_LANGUAGE]}"> 93.50 -<fmt:setLocale scope="request" value="${sessionScope[Constants.SESSION_ATTR_LANGUAGE]}"/> 93.51 -</c:if> 93.52 - 93.53 -<!DOCTYPE html> 93.54 -<html> 93.55 - <head> 93.56 - <base href="${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/"> 93.57 - <title>LightPIT - 93.58 - <fmt:bundle basename="${moduleInfo.bundleBaseName}"> 93.59 - <fmt:message key="${moduleInfo.titleKey}" /> 93.60 - </fmt:bundle> 93.61 - </title> 93.62 - <meta charset="UTF-8"> 93.63 - <link rel="stylesheet" href="lightpit.css" type="text/css"> 93.64 - <c:if test="${not empty extraCss}"> 93.65 - <link rel="stylesheet" href="${extraCss}" type="text/css"> 93.66 - </c:if> 93.67 - </head> 93.68 - <body> 93.69 - <div id="mainMenu"> 93.70 - <c:forEach var="menu" items="${mainMenu}"> 93.71 - <div class="menuEntry" 93.72 - <c:if test="${requestScope[Constants.REQ_ATTR_MODULE_CLASSNAME] eq menu.moduleClassName}"> 93.73 - data-active 93.74 - </c:if> 93.75 - > 93.76 - <a href="${menu.pathName}"> 93.77 - <fmt:bundle basename="${menu.resourceKey.bundle}"> 93.78 - <fmt:message key="${menu.resourceKey.key}" /> 93.79 - </fmt:bundle> 93.80 - </a> 93.81 - </div> 93.82 - </c:forEach> 93.83 - </div> 93.84 - <div id="subMenu"> 93.85 - 93.86 - </div> 93.87 - <div id="content-area"> 93.88 - <c:if test="${not empty fragment}"> 93.89 - <fmt:setBundle scope="request" basename="${moduleInfo.bundleBaseName}"/> 93.90 - <c:import url="${fragment}" /> 93.91 - </c:if> 93.92 - </div> 93.93 - </body> 93.94 -</html>
94.1 --- a/web/WEB-INF/web.xml Sun Apr 08 16:51:15 2018 +0200 94.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 94.3 @@ -1,24 +0,0 @@ 94.4 -<?xml version="1.0" encoding="UTF-8"?> 94.5 -<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> 94.6 - <session-config> 94.7 - <session-timeout> 94.8 - 30 94.9 - </session-timeout> 94.10 - </session-config> 94.11 - <context-param> 94.12 - <param-name>available-languages</param-name> 94.13 - <param-value>en,de</param-value> 94.14 - </context-param> 94.15 - <error-page> 94.16 - <error-code>404</error-code> 94.17 - <location>/error/404</location> 94.18 - </error-page> 94.19 - <error-page> 94.20 - <error-code>403</error-code> 94.21 - <location>/error/403</location> 94.22 - </error-page> 94.23 - <error-page> 94.24 - <error-code>500</error-code> 94.25 - <location>/error/500</location> 94.26 - </error-page> 94.27 -</web-app>
95.1 --- a/web/error.css Sun Apr 08 16:51:15 2018 +0200 95.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 95.3 @@ -1,55 +0,0 @@ 95.4 -/* 95.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 95.6 - * 95.7 - * Copyright 2018 Mike Becker. All rights reserved. 95.8 - * 95.9 - * Redistribution and use in source and binary forms, with or without 95.10 - * modification, are permitted provided that the following conditions are met: 95.11 - * 95.12 - * 1. Redistributions of source code must retain the above copyright 95.13 - * notice, this list of conditions and the following disclaimer. 95.14 - * 95.15 - * 2. Redistributions in binary form must reproduce the above copyright 95.16 - * notice, this list of conditions and the following disclaimer in the 95.17 - * documentation and/or other materials provided with the distribution. 95.18 - * 95.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 95.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 95.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 95.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 95.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 95.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 95.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 95.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 95.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 95.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 95.29 - * POSSIBILITY OF SUCH DAMAGE. 95.30 - * 95.31 - */ 95.32 - 95.33 -#error-page h1 { 95.34 - font-size: 1.5em; 95.35 -} 95.36 - 95.37 -#error-page table { 95.38 - width: 100%; 95.39 - 95.40 - border-top-style: solid; 95.41 - border-top-width: 1pt; 95.42 - border-top-color: #606060; 95.43 - 95.44 - border-bottom-style: solid; 95.45 - border-bottom-width: 1pt; 95.46 - border-bottom-color: #505050; 95.47 - 95.48 - border-collapse: separate; 95.49 - border-spacing: .5em; 95.50 -} 95.51 - 95.52 -#error-page table th { 95.53 - text-align: right; 95.54 -} 95.55 - 95.56 -#error-page table td { 95.57 - width: 100%; 95.58 -}
96.1 --- a/web/index.jsp Sun Apr 08 16:51:15 2018 +0200 96.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 96.3 @@ -1,32 +0,0 @@ 96.4 -<%-- 96.5 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 96.6 - 96.7 -Copyright 2018 Mike Becker. All rights reserved. 96.8 - 96.9 -Redistribution and use in source and binary forms, with or without 96.10 -modification, are permitted provided that the following conditions are met: 96.11 - 96.12 -1. Redistributions of source code must retain the above copyright 96.13 -notice, this list of conditions and the following disclaimer. 96.14 - 96.15 -2. Redistributions in binary form must reproduce the above copyright 96.16 -notice, this list of conditions and the following disclaimer in the 96.17 -documentation and/or other materials provided with the distribution. 96.18 - 96.19 -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 96.20 -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 96.21 -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 96.22 -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 96.23 -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 96.24 -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 96.25 -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 96.26 -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 96.27 -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 96.28 -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 96.29 ---%> 96.30 -<%@page import="de.uapcore.lightpit.Functions" %> 96.31 -<%@page import="de.uapcore.lightpit.modules.HomeModule" %> 96.32 -<% 96.33 -response.setStatus(response.SC_MOVED_TEMPORARILY); 96.34 -response.setHeader("Location", "./"+Functions.modulePathOf(HomeModule.class)); 96.35 -%>
97.1 --- a/web/language.css Sun Apr 08 16:51:15 2018 +0200 97.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 97.3 @@ -1,46 +0,0 @@ 97.4 -/* 97.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 97.6 - * 97.7 - * Copyright 2018 Mike Becker. All rights reserved. 97.8 - * 97.9 - * Redistribution and use in source and binary forms, with or without 97.10 - * modification, are permitted provided that the following conditions are met: 97.11 - * 97.12 - * 1. Redistributions of source code must retain the above copyright 97.13 - * notice, this list of conditions and the following disclaimer. 97.14 - * 97.15 - * 2. Redistributions in binary form must reproduce the above copyright 97.16 - * notice, this list of conditions and the following disclaimer in the 97.17 - * documentation and/or other materials provided with the distribution. 97.18 - * 97.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 97.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 97.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 97.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 97.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 97.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 97.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 97.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 97.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 97.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 97.29 - * POSSIBILITY OF SUCH DAMAGE. 97.30 - * 97.31 - */ 97.32 - 97.33 -#lang-selector { 97.34 - max-width: 30%; 97.35 - display: flex; 97.36 - flex-basis: content; 97.37 - flex-direction: column; 97.38 -} 97.39 - 97.40 -input { 97.41 - margin: .5em; 97.42 -} 97.43 - 97.44 -span.blNA { 97.45 - margin: .5em; 97.46 - color: red; 97.47 - font-style: italic; 97.48 - font-size: smaller; 97.49 -}
98.1 --- a/web/lightpit.css Sun Apr 08 16:51:15 2018 +0200 98.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 98.3 @@ -1,129 +0,0 @@ 98.4 -/* 98.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 98.6 - * 98.7 - * Copyright 2018 Mike Becker. All rights reserved. 98.8 - * 98.9 - * Redistribution and use in source and binary forms, with or without 98.10 - * modification, are permitted provided that the following conditions are met: 98.11 - * 98.12 - * 1. Redistributions of source code must retain the above copyright 98.13 - * notice, this list of conditions and the following disclaimer. 98.14 - * 98.15 - * 2. Redistributions in binary form must reproduce the above copyright 98.16 - * notice, this list of conditions and the following disclaimer in the 98.17 - * documentation and/or other materials provided with the distribution. 98.18 - * 98.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 98.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 98.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 98.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 98.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 98.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 98.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 98.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 98.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 98.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 98.29 - * POSSIBILITY OF SUCH DAMAGE. 98.30 - * 98.31 - */ 98.32 - 98.33 -html { 98.34 - background: #f8f8f8; 98.35 -} 98.36 - 98.37 -body { 98.38 - background: white; 98.39 - font-family: serif; 98.40 - 98.41 - border-color: #505050; 98.42 - border-style: solid; 98.43 - border-width: 1pt; 98.44 - 98.45 - color: #1c202e; 98.46 -} 98.47 - 98.48 -h1, h2, h3, h4, #mainMenu, #subMenu { 98.49 - font-family: sans-serif; 98.50 -} 98.51 - 98.52 -a { 98.53 - color: #3060f8; 98.54 - text-decoration: none; 98.55 -} 98.56 - 98.57 -#mainMenu { 98.58 - width: 100%; 98.59 - display: flex; 98.60 - flex-flow: row wrap; 98.61 - background: #f0f0f5; 98.62 -} 98.63 - 98.64 -#subMenu { 98.65 - background: #f7f7ff; 98.66 - 98.67 - border-image: linear-gradient(to right, #606060, rgba(60,60,60,.25)); 98.68 - border-image-slice: 1; 98.69 - border-top-style: solid; 98.70 - border-top-width: 1pt; 98.71 - border-bottom-style: solid; 98.72 - border-bottom-width: 1pt; 98.73 -} 98.74 - 98.75 -.menuEntry { 98.76 - padding: .25em 1em .25em 1em; 98.77 - border-right-style: solid; 98.78 - border-right-width: 1pt; 98.79 - border-right-color: #9095a1; 98.80 -} 98.81 - 98.82 -#mainMenu .menuEntry[data-active] { 98.83 - background: #e0e0e5; 98.84 -} 98.85 - 98.86 -#subMenu .menuEntry[data-active] { 98.87 - background: #e7e7ef 98.88 -} 98.89 - 98.90 -#content-area { 98.91 - padding: 1em; 98.92 -} 98.93 - 98.94 -th { 98.95 - text-align: left; 98.96 -} 98.97 - 98.98 -table.datatable { 98.99 - width: 100%; 98.100 - border-style: solid; 98.101 - border-width: 1pt; 98.102 - border-color: black; 98.103 - border-collapse: collapse; 98.104 -} 98.105 - 98.106 -table.datatable th { 98.107 - font-weight: bold; 98.108 - background: lightsteelblue; 98.109 -} 98.110 - 98.111 -table.datatable th, table.datatable td { 98.112 - border-style: solid; 98.113 - border-width: 1pt; 98.114 - border-color: black; 98.115 - padding: .4em; 98.116 -} 98.117 - 98.118 -table.datatable tr:nth-child(2n) { 98.119 - background: lightblue; 98.120 -} 98.121 - 98.122 -.hcenter { 98.123 - text-align: center; 98.124 -} 98.125 - 98.126 -.smalltext { 98.127 - font-size: smaller; 98.128 -} 98.129 - 98.130 -.nowrap { 98.131 - white-space: nowrap; 98.132 -} 98.133 \ No newline at end of file