diff --git a/webanno b/webanno index 3fcee8c..19cadc1 160000 --- a/webanno +++ b/webanno @@ -1 +1 @@ -Subproject commit 3fcee8ccb60695e6855c0558afab9120d78f50cd +Subproject commit 19cadc1ebf6ca10cced32930cc3e25f76ef62537 diff --git a/webanno-webapp-exm/.checkstyle b/webanno-webapp-exm/.checkstyle new file mode 100644 index 0000000..9962c15 --- /dev/null +++ b/webanno-webapp-exm/.checkstyle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/webanno-webapp-exm/application.properties b/webanno-webapp-exm/application.properties new file mode 100644 index 0000000..98009b5 --- /dev/null +++ b/webanno-webapp-exm/application.properties @@ -0,0 +1,32 @@ +# =================================================================== +# WebAnno Properties +# =================================================================== + +database.initial-pool-size=4 +database.min-pool-size=4 +database.max-pool-size=10 +database.generate=update + +backup.keep.time=0 +backup.interval=0 +backup.keep.number=0 + +ui.brat.sentences.number=5 + +debug.casDoctor.checks= +debug.casDoctor.repairs= +debug.casDoctor.fatal=false +debug.casDoctor.forceReleaseBehavior=false + +# =================================================================== +# Spring Boot Properties +# =================================================================== + +# IDENTITY (ContextIdApplicationContextInitializer) +spring.application.name=WebAnno + +# MULTIPART (MultipartProperties) +spring.http.multipart.max-file-size=100MB +spring.http.multipart.max-request-size=100MB + +spring.resources.cache-period=31536000 \ No newline at end of file diff --git a/webanno-webapp-exm/pom.xml b/webanno-webapp-exm/pom.xml index a063808..2b4e1fd 100644 --- a/webanno-webapp-exm/pom.xml +++ b/webanno-webapp-exm/pom.xml @@ -109,6 +109,10 @@ org.springframework spring-core + + org.springframework + spring-beans + org.springframework spring-orm @@ -186,6 +190,10 @@ de.tudarmstadt.ukp.clarin.webanno webanno-io-tcf + + de.tudarmstadt.ukp.clarin.webanno + webanno-io-json + de.tudarmstadt.ukp.clarin.webanno webanno-io-conllu @@ -317,7 +325,10 @@ org.springframework.boot spring-boot-maven-plugin - 1.5.4.RELEASE + ${spring.boot.version} + + true + @@ -332,9 +343,8 @@ copy-war-to-jar package @@ -343,7 +353,8 @@ - + + @@ -375,6 +386,7 @@ de.tudarmstadt.ukp.clarin.webanno:webanno-io-tei de.tudarmstadt.ukp.clarin.webanno:webanno-io-tsv de.tudarmstadt.ukp.clarin.webanno:webanno-io-tcf + de.tudarmstadt.ukp.clarin.webanno:webanno-io-json de.tudarmstadt.ukp.clarin.webanno:webanno-io-xmi de.tudarmstadt.ukp.clarin.webanno:webanno-io-conllu de.tudarmstadt.ukp.clarin.webanno:webanno-io-text diff --git a/webanno-webapp-exm/src/main/docker/Dockerfile b/webanno-webapp-exm/src/main/docker/Dockerfile index 66b762e..85d2933 100644 --- a/webanno-webapp-exm/src/main/docker/Dockerfile +++ b/webanno-webapp-exm/src/main/docker/Dockerfile @@ -1,59 +1,23 @@ ############################################################ +# # Dockerfile to build webanno container images # -# Inspired by -# * https://github.com/NLPbox/webanno-docker -# * https://github.com/simonmeoni/webanno-docker ############################################################ -################## BEGIN INSTALLATION ###################### -FROM tomcat:7-jre8 +FROM openjdk:8 MAINTAINER WebAnno Team -RUN apt-get update -# Install tomcat utilities (we will need tomcat7-instance-create) and mysql -#RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget mysql-server mysql-client tomcat7-user tomcat7-admin authbind -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget tomcat7-user tomcat7-admin authbind - -# Copy webanno and mysql settings to tmp -# COPY create_webanno_db.sql mysql-init /tmp/ - -# Setup mysql as depicted in the webanno admin guide -# RUN service mysql stop -# RUN mysqld_safe --init-file=/tmp/mysql-init & -# RUN rm /tmp/mysql-init -# RUN service mysql start && \ -# mysql -u root < /tmp/create_webanno_db.sql - -WORKDIR /opt - -# Create a tomcat7 instance of webanno to operate on port 18080 as -# shown in the official admin guide -RUN tomcat7-instance-create -p 18080 -c 18005 webanno && \ - chown -R www-data /opt/webanno - -# create some folders to get rid of tomcat7 warnings -RUN mkdir -p /usr/share/tomcat7/common/classes /usr/share/tomcat7/server/classes /usr/share/tomcat7/shared/classes +WORKDIR /opt/webanno -# Rename the webanno webapp -COPY webanno_initd /etc/init.d/webanno -COPY @docker.warfile@ /opt/webanno/webapps/ROOT.war - -# Setup webanno as a service -RUN chmod +x /etc/init.d/webanno -RUN update-rc.d webanno defaults +COPY @docker.warfile@ webanno-standalone.jar +# this will be the WebAnno home folder RUN mkdir /export -RUN chown -R www-data /export -# COPY settings.properties /export/settings.properties - -COPY entrypoint.sh /opt/webanno/entrypoint.sh - -##################### INSTALLATION END ##################### - VOLUME /export -EXPOSE 18080 +EXPOSE 8080 + +ENV JAVA_OPTS="-Xmx750m" -CMD bash /opt/webanno/entrypoint.sh +CMD java ${JAVA_OPTS} -Djava.awt.headless=true -XX:+UseConcMarkSweepGC -Dwebanno.home=/export -jar webanno-standalone.jar diff --git a/webanno-webapp-exm/src/main/docker/README b/webanno-webapp-exm/src/main/docker/README index 52f2443..7c57336 100644 --- a/webanno-webapp-exm/src/main/docker/README +++ b/webanno-webapp-exm/src/main/docker/README @@ -1,3 +1,9 @@ -docker run -v /path/on/host/webanno/repository:/export -p 18080:18080 webanno/webanno:latest +mvn -Pdocker clean install docker:build (optionally add docker:push) --v /my/own/datadir:/var/lib/mysql \ No newline at end of file +docker run -v /path/on/host/webanno/repository:/export -p port-on-host:8080 webanno/webanno:latest + +export WEBANNO_HOME=/path/on/host/webanno +export WEBANNO_PORT=port-on-host +docker-compose up -d + +docker-compose down diff --git a/webanno-webapp-exm/src/main/docker/create_webanno_db.sql b/webanno-webapp-exm/src/main/docker/create_webanno_db.sql deleted file mode 100644 index 323bfc3..0000000 --- a/webanno-webapp-exm/src/main/docker/create_webanno_db.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE DATABASE webanno DEFAULT CHARACTER SET utf8 COLLATE utf8_bin ; - -CREATE USER 'webanno'@'localhost' IDENTIFIED BY 't0t4llYSecreT'; -GRANT ALL PRIVILEGES ON webanno.* TO 'webanno'@'localhost'; diff --git a/webanno-webapp-exm/src/main/docker/docker-compose.yml b/webanno-webapp-exm/src/main/docker/docker-compose.yml new file mode 100644 index 0000000..c0a4722 --- /dev/null +++ b/webanno-webapp-exm/src/main/docker/docker-compose.yml @@ -0,0 +1,49 @@ +## +# docker-compose up [-d] +# docker-compose down +## +version: '2.1' + +networks: + webanno-net: + +services: + mysqlserver: + image: "mysql:5" + environment: + - MYSQL_RANDOM_ROOT_PASSWORD=yes + - MYSQL_DATABASE=webanno + - MYSQL_USER=webanno + - MYSQL_PORT=3306 + - MYSQL_PASSWORD=webanno + volumes: + - ${WEBANNO_HOME}./mysql-data:/var/lib/mysql + command: ["--character-set-server=utf8", "--collation-server=utf8_bin"] + healthcheck: + test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "-pwebanno", "-uwebanno"] + interval: 20s + timeout: 10s + retries: 10 + networks: + webanno-net: + + webserver: + image: "webanno/webanno-snapshots:latest" + ports: + - "${WEBANNO_PORT}:8080" + environment: + - WEBANNO_DB_DIALECT=org.hibernate.dialect.MySQL5InnoDBDialect + - WEBANNO_DB_DRIVER=com.mysql.jdbc.Driver + - WEBANNO_DB_URL=jdbc:mysql://mysqlserver:3306/webanno?useSSL=false&useUnicode=true&characterEncoding=UTF-8 + - WEBANNO_DB_USERNAME=webanno + - WEBANNO_DB_PASSWORD=webanno + volumes: + - ${WEBANNO_HOME}./server-data:/export + depends_on: + mysqlserver: + condition: service_healthy + mem_limit: 4g + memswap_limit: 5g + restart: unless-stopped + networks: + webanno-net: diff --git a/webanno-webapp-exm/src/main/docker/entrypoint.sh b/webanno-webapp-exm/src/main/docker/entrypoint.sh deleted file mode 100644 index 2c47618..0000000 --- a/webanno-webapp-exm/src/main/docker/entrypoint.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -#service mysql start -service webanno start -tail -F /opt/webanno/logs/* diff --git a/webanno-webapp-exm/src/main/docker/mysql-init b/webanno-webapp-exm/src/main/docker/mysql-init deleted file mode 100644 index ce875e7..0000000 --- a/webanno-webapp-exm/src/main/docker/mysql-init +++ /dev/null @@ -1,2 +0,0 @@ -UPDATE mysql.user SET Password=PASSWORD('root') WHERE User='root'; -FLUSH PRIVILEGES; diff --git a/webanno-webapp-exm/src/main/docker/settings.properties b/webanno-webapp-exm/src/main/docker/settings.properties deleted file mode 100644 index 402232c..0000000 --- a/webanno-webapp-exm/src/main/docker/settings.properties +++ /dev/null @@ -1,13 +0,0 @@ -database.dialect=org.hibernate.dialect.MySQL5InnoDBDialect -database.driver=com.mysql.jdbc.Driver -database.url=jdbc:mysql://localhost/webanno -database.username=webanno -database.password=t0t4llYSecreT - -# 60 * 60 * 24 * 30 = 30 days -backup.keep.time=1000000 - -# 60 * 5 = 5 minutes -backup.interval=1000 - -backup.keep.number=10 diff --git a/webanno-webapp-exm/src/main/docker/webanno_initd b/webanno-webapp-exm/src/main/docker/webanno_initd deleted file mode 100644 index 601bbd1..0000000 --- a/webanno-webapp-exm/src/main/docker/webanno_initd +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh - -# Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 - -# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing. -if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then - set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script -fi -### BEGIN INIT INFO -# Provides: webanno -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: WebAnno init script -# Description: This file should be placed in /etc/init.d. It -# allows starting/stopping WebAnno using the -# "service" command and ensures that WebAnno starts -# when the system is booted. -### END INIT INFO - -# Author: Richard Eckart de Castilho - -NAME="WebAnno" -DAEMON=none -WEBANNO_HOME="/export" -WEBANNO_PORT="18080" -WEBANNO_USER="www-data" -CATALINA_BASE="/opt/webanno" -AUTHBIND="" -JAVA_OPTS="-Djava.awt.headless=true -Xmx750m -XX:+UseConcMarkSweepGC -Dwebanno.home=$WEBANNO_HOME" - -setup_authbind() { - # log_action_msg "Setting up authbind configuration for $DESC on port $WEBANNO_PORT" - touch /etc/authbind/byport/$WEBANNO_PORT - chmod 500 /etc/authbind/byport/$WEBANNO_PORT - chown $WEBANNO_USER /etc/authbind/byport/$WEBANNO_PORT - AUTHBIND="authbind --deep" -} - -tomcat_pid() { - echo `ps -fe | grep -- "-Dcatalina.base=$CATALINA_BASE" | grep -v grep | tr -s " "|cut -d" " -f2` -} - -do_start_cmd_override() { - if [ $WEBANNO_PORT -lt 1024 ] - then - setup_authbind - fi - - su - www-data -s "/bin/bash" -c "JAVA_OPTS=\"$JAVA_OPTS\" $AUTHBIND $CATALINA_BASE/bin/startup.sh" > /dev/null 2>&1 -} - -do_stop_cmd_override() { - su - www-data -s "/bin/bash" -c "$CATALINA_BASE/bin/shutdown.sh" > /dev/null 2>&1 -} - -do_status() { - local pid - pid=$(tomcat_pid) - if [ -n "$pid" ] - then - log_action_msg "Status $DESC: running" - return 0 - else - log_action_msg "Status $DESC: stopped" - return 1 - fi -} \ No newline at end of file diff --git a/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/WebAnno.java b/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/WebAnno.java index a2fe358..ad0f774 100644 --- a/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/WebAnno.java +++ b/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/WebAnno.java @@ -17,25 +17,33 @@ */ package de.tudarmstadt.ukp.clarin.webanno.webapp; +import java.util.Optional; + +import javax.swing.JWindow; import javax.validation.Validator; +import org.apache.catalina.connector.Connector; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; +import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ImportResource; import org.springframework.context.annotation.Primary; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; +import de.tudarmstadt.ukp.clarin.webanno.support.standalone.LoadingSplashScreen; +import de.tudarmstadt.ukp.clarin.webanno.support.standalone.ShutdownDialogAvailableEvent; import de.tudarmstadt.ukp.clarin.webanno.webapp.config.WebAnnoApplicationContextInitializer; import de.tudarmstadt.ukp.clarin.webanno.webapp.config.WebAnnoBanner; /** * Boots WebAnno in standalone JAR or WAR modes. */ -@SpringBootApplication +@SpringBootApplication(scanBasePackages = "de.tudarmstadt.ukp.clarin.webanno") @ImportResource({ "classpath:/META-INF/application-context.xml", "classpath:/META-INF/rest-context.xml", @@ -44,17 +52,27 @@ public class WebAnno extends SpringBootServletInitializer { + private static final String PROTOCOL = "AJP/1.3"; + + @Value("${tomcat.ajp.port:-1}") + private int ajpPort; + @Bean @Primary public Validator validator() { return new LocalValidatorFactoryBean(); } - + @Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory(); + if (ajpPort > 0) { + Connector ajpConnector = new Connector(PROTOCOL); + ajpConnector.setPort(ajpPort); + tomcat.addAdditionalTomcatConnectors(ajpConnector); + } return tomcat; } @@ -71,20 +89,25 @@ private static void init(SpringApplicationBuilder aBuilder) { aBuilder.banner(new WebAnnoBanner()); aBuilder.initializers(new WebAnnoApplicationContextInitializer()); + aBuilder.headless(false); } public static void main(String[] args) throws Exception { - // If running from the command line, we default do assuming that there is a head - if (System.getProperty("java.awt.headless") == null) { - System.setProperty("java.awt.headless", "false"); - } + Optional splash = LoadingSplashScreen + .setupScreen(WebAnno.class.getResource("splash.png")); SpringApplicationBuilder builder = new SpringApplicationBuilder(); // Signal that we may need the shutdown dialog builder.properties("running.from.commandline=true"); init(builder); builder.sources(WebAnno.class); + builder.listeners(event -> { + if (event instanceof ApplicationReadyEvent + || event instanceof ShutdownDialogAvailableEvent) { + splash.ifPresent(it -> it.dispose()); + } + }); builder.run(args); } } diff --git a/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/WebAnnoResourcesBehavior.java b/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/WebAnnoResourcesBehavior.java new file mode 100644 index 0000000..a831b73 --- /dev/null +++ b/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/WebAnnoResourcesBehavior.java @@ -0,0 +1,48 @@ +/* + * Copyright 2017 + * Ubiquitous Knowledge Processing (UKP) Lab and FG Language Technology + * Technische Universität Darmstadt + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package de.tudarmstadt.ukp.clarin.webanno.webapp; + +import org.apache.wicket.Component; +import org.apache.wicket.behavior.Behavior; +import org.apache.wicket.markup.head.CssHeaderItem; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; + +import de.tudarmstadt.ukp.clarin.webanno.ui.core.page.WebAnnoCssReference; +import de.tudarmstadt.ukp.clarin.webanno.ui.core.page.WebAnnoJavascriptReference; + +public class WebAnnoResourcesBehavior + extends Behavior +{ + private static final long serialVersionUID = 8847646938685436192L; + + private static final WebAnnoResourcesBehavior INSTANCE = new WebAnnoResourcesBehavior(); + + @Override + public void renderHead(Component aComponent, IHeaderResponse aResponse) + { + // Loading WebAnno CSS here so it can override JQuery/Kendo CSS + aResponse.render(CssHeaderItem.forReference(WebAnnoCssReference.get())); + aResponse.render(JavaScriptHeaderItem.forReference(WebAnnoJavascriptReference.get())); + } + + public static WebAnnoResourcesBehavior get() + { + return INSTANCE; + } +} diff --git a/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/WicketApplication.java b/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/WicketApplication.java index d4b1459..05333d8 100644 --- a/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/WicketApplication.java +++ b/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/WicketApplication.java @@ -19,7 +19,6 @@ import org.apache.wicket.Page; import org.apache.wicket.injection.Injector; -import org.springframework.stereotype.Component; import de.tudarmstadt.ukp.clarin.webanno.ui.core.WicketApplicationBase; import de.tudarmstadt.ukp.clarin.webanno.ui.exmaralda.MediaResourceReference; @@ -30,7 +29,7 @@ * The Wicket application class. Sets up pages, authentication, theme, and other application-wide * configuration. */ -@Component("wicketApplication") +@org.springframework.stereotype.Component("wicketApplication") public class WicketApplication extends WicketApplicationBase { @@ -42,20 +41,36 @@ public Class getHomePage() { return MainMenuPage.class; } - + @Override - protected void init() { - super.init(); - MediaResourceReference mediaresources = new MediaResourceReference(); - Injector.get().inject(mediaresources); // manually inject springbeans since autoinjection only works for subclasses of Component - // mount the media resource - mountResource( - String.format("/media/${%s}/${%s}", - MediaResourceStreamResource.PAGE_PARAM_PROJECT_ID, - MediaResourceStreamResource.PAGE_PARAM_FILE_ID), - mediaresources); + protected void initWebFrameworks() + { + super.initWebFrameworks(); + + initWebAnnoResources(); + } + + protected void initWebAnnoResources() + { + getComponentInstantiationListeners().add(component -> { + if (component instanceof Page) { + component.add(new WebAnnoResourcesBehavior()); + } + }); + } + + protected void initWebAnnoExmResources(){ + MediaResourceReference mediaresources = new MediaResourceReference(); + Injector.get().inject(mediaresources); // manually inject springbeans since autoinjection only works for subclasses of Component + // mount the media resource + mountResource( + String.format("/media/${%s}/${%s}", + MediaResourceStreamResource.PAGE_PARAM_PROJECT_ID, + MediaResourceStreamResource.PAGE_PARAM_FILE_ID), + mediaresources); + } } diff --git a/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/config/SpringWebMvcConfiguration.java b/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/config/SpringWebMvcConfiguration.java deleted file mode 100644 index 66010cb..0000000 --- a/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/config/SpringWebMvcConfiguration.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017 - * Ubiquitous Knowledge Processing (UKP) Lab and FG Language Technology - * Technische Universität Darmstadt - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package de.tudarmstadt.ukp.clarin.webanno.webapp.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.validation.Validator; -import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; - -@Configuration -public class SpringWebMvcConfiguration - extends WebMvcConfigurerAdapter -{ - @Bean - @Primary - public Validator myValidator() - { - return new LocalValidatorFactoryBean(); - } - - @Override - public Validator getValidator() - { - return myValidator(); - } -} diff --git a/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/config/WebAnnoApplicationContextInitializer.java b/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/config/WebAnnoApplicationContextInitializer.java index 0e97565..ebe4ccf 100644 --- a/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/config/WebAnnoApplicationContextInitializer.java +++ b/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/config/WebAnnoApplicationContextInitializer.java @@ -29,7 +29,6 @@ import org.springframework.core.io.support.ResourcePropertySource; import de.tudarmstadt.ukp.clarin.webanno.support.SettingsUtil; -import de.tudarmstadt.ukp.clarin.webanno.support.logging.LoggingFilter; public class WebAnnoApplicationContextInitializer implements ApplicationContextInitializer @@ -44,8 +43,6 @@ public class WebAnnoApplicationContextInitializer @Override public void initialize(ConfigurableApplicationContext aApplicationContext) { - LoggingFilter.setLoggingUsername("SYSTEM"); - ConfigurableEnvironment aEnvironment = aApplicationContext.getEnvironment(); File settings = SettingsUtil.getSettingsFile(); diff --git a/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/splash.png b/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/splash.png new file mode 100644 index 0000000..08a6268 Binary files /dev/null and b/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/splash.png differ diff --git a/webanno-webapp-exm/src/main/resources/META-INF/application-context.xml b/webanno-webapp-exm/src/main/resources/META-INF/application-context.xml index 3959cf8..0f1cacf 100644 --- a/webanno-webapp-exm/src/main/resources/META-INF/application-context.xml +++ b/webanno-webapp-exm/src/main/resources/META-INF/application-context.xml @@ -1,80 +1,70 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:tx="http://www.springframework.org/schema/tx" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd"> - - - - - - true - - - - classpath:META-INF/formats.properties - file:#{systemProperties['webanno.home'] ?: systemProperties['user.home'].concat('/.webanno') }/formats.properties - - - - - - - - - - 0 - 0 - 0 - 5 - #{systemProperties['webanno.home'] ?: systemProperties['user.home'].concat('/.webanno') }/repository/ - - - false - false - - - - - - file:#{systemProperties['webanno.home'] ?: systemProperties['user.home'].concat('/.webanno') }/settings.properties - - - + + + true + + + + classpath:META-INF/formats.properties + file:#{systemProperties['webanno.home'] ?: systemProperties['user.home'].concat('/.webanno') }/formats.properties + + + + + + + + + + #{systemProperties['webanno.home'] ?: systemProperties['user.home'].concat('/.webanno') }/repository/ + + + + + + file:#{systemProperties['webanno.home'] ?: systemProperties['user.home'].concat('/.webanno') }/settings.properties + + + - - - - - - - + + + + + + + diff --git a/webanno-webapp-exm/src/main/resources/META-INF/database-context.xml b/webanno-webapp-exm/src/main/resources/META-INF/database-context.xml index 3d23542..5074266 100644 --- a/webanno-webapp-exm/src/main/resources/META-INF/database-context.xml +++ b/webanno-webapp-exm/src/main/resources/META-INF/database-context.xml @@ -1,102 +1,97 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd"> - - - - - - #{systemEnvironment['WEBANNO_DB_DIALECT'] ?: 'org.hibernate.dialect.HSQLDialect'} - #{systemEnvironment['WEBANNO_DB_DRIVER'] ?: 'org.hsqldb.jdbc.JDBCDriver'} - #{systemEnvironment['WEBANNO_DB_URL'] ?: 'jdbc:hsqldb:file:'.concat(systemProperties['webanno.home'] ?: systemProperties['user.home'].concat('/.webanno')).concat('/db/webanno;hsqldb.default_table_type=cached')} - #{systemEnvironment['WEBANNO_DB_USERNAME'] ?: 'sa'} - #{systemEnvironment['WEBANNO_DB_PASSWORD'] ?: ''} - 4 - 4 - 10 - update - - - - - - file:#{systemProperties['webanno.home'] ?: systemProperties['user.home'].concat('/.webanno') }/settings.properties - - - + + + + + + #{systemEnvironment['WEBANNO_DB_DIALECT'] ?: 'org.hibernate.dialect.HSQLDialect'} + #{systemEnvironment['WEBANNO_DB_DRIVER'] ?: 'org.hsqldb.jdbc.JDBCDriver'} + #{systemEnvironment['WEBANNO_DB_URL'] ?: 'jdbc:hsqldb:file:'.concat(systemProperties['webanno.home'] ?: systemProperties['user.home'].concat('/.webanno')).concat('/db/webanno;hsqldb.default_table_type=cached')} + #{systemEnvironment['WEBANNO_DB_USERNAME'] ?: 'sa'} + #{systemEnvironment['WEBANNO_DB_PASSWORD'] ?: ''} + + + + + + file:#{systemProperties['webanno.home'] ?: systemProperties['user.home'].concat('/.webanno') }/settings.properties + + + - + - - - + + + - + - - - - + + + + de.tudarmstadt.ukp.clarin.webanno - - - - - - - - - ${database.dialect} - ${database.generate} - - - - + + + + + + + + + ${database.dialect} + ${database.generate} + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - + + + + + diff --git a/webanno-webapp-exm/src/main/resources/META-INF/formats.properties b/webanno-webapp-exm/src/main/resources/META-INF/formats.properties index 1591256..c8cd816 100644 --- a/webanno-webapp-exm/src/main/resources/META-INF/formats.properties +++ b/webanno-webapp-exm/src/main/resources/META-INF/formats.properties @@ -13,6 +13,9 @@ xmi.label=UIMA XMI xmi.reader=de.tudarmstadt.ukp.clarin.webanno.xmi.XmiReader xmi.writer=de.tudarmstadt.ukp.clarin.webanno.xmi.XmiWriter +json.label=UIMA JSON +json.writer=de.tudarmstadt.ukp.clarin.webanno.json.JsonWriter + conll2000.label=CoNLL 2000 conll2000.reader=de.tudarmstadt.ukp.dkpro.core.io.conll.Conll2000Reader conll2000.writer=de.tudarmstadt.ukp.dkpro.core.io.conll.Conll2000Writer diff --git a/webanno-webapp-exm/src/main/resources/META-INF/preAuthSecurity-context.xml b/webanno-webapp-exm/src/main/resources/META-INF/preAuthSecurity-context.xml index 3360982..9a0584f 100644 --- a/webanno-webapp-exm/src/main/resources/META-INF/preAuthSecurity-context.xml +++ b/webanno-webapp-exm/src/main/resources/META-INF/preAuthSecurity-context.xml @@ -20,7 +20,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/security" xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xs + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd"> @@ -57,6 +57,7 @@ + diff --git a/webanno-webapp-exm/src/main/resources/META-INF/rest-context.xml b/webanno-webapp-exm/src/main/resources/META-INF/rest-context.xml index 3aec1a5..f1a95d0 100644 --- a/webanno-webapp-exm/src/main/resources/META-INF/rest-context.xml +++ b/webanno-webapp-exm/src/main/resources/META-INF/rest-context.xml @@ -23,51 +23,12 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - 104857600 - - - 4096 - - - - + diff --git a/webanno-webapp-exm/src/main/resources/META-INF/security-context.xml b/webanno-webapp-exm/src/main/resources/META-INF/security-context.xml index 9132bf6..8908e57 100644 --- a/webanno-webapp-exm/src/main/resources/META-INF/security-context.xml +++ b/webanno-webapp-exm/src/main/resources/META-INF/security-context.xml @@ -19,8 +19,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:security="http://www.springframework.org/schema/security" xsi:schemaLocation=" - http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-4.2.xsd + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd"> diff --git a/webanno-webapp-exm/src/main/resources/META-INF/static-resources-context.xml b/webanno-webapp-exm/src/main/resources/META-INF/static-resources-context.xml index dbfb9cc..ac1e04b 100644 --- a/webanno-webapp-exm/src/main/resources/META-INF/static-resources-context.xml +++ b/webanno-webapp-exm/src/main/resources/META-INF/static-resources-context.xml @@ -27,7 +27,4 @@ - - - diff --git a/webanno-webapp-exm/src/main/resources/META-INF/web-application-servlet.xml b/webanno-webapp-exm/src/main/resources/META-INF/web-application-servlet.xml deleted file mode 100644 index 02aed4f..0000000 --- a/webanno-webapp-exm/src/main/resources/META-INF/web-application-servlet.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - diff --git a/webanno-webapp-exm/src/main/resources/application.properties b/webanno-webapp-exm/src/main/resources/application.properties new file mode 100644 index 0000000..98009b5 --- /dev/null +++ b/webanno-webapp-exm/src/main/resources/application.properties @@ -0,0 +1,32 @@ +# =================================================================== +# WebAnno Properties +# =================================================================== + +database.initial-pool-size=4 +database.min-pool-size=4 +database.max-pool-size=10 +database.generate=update + +backup.keep.time=0 +backup.interval=0 +backup.keep.number=0 + +ui.brat.sentences.number=5 + +debug.casDoctor.checks= +debug.casDoctor.repairs= +debug.casDoctor.fatal=false +debug.casDoctor.forceReleaseBehavior=false + +# =================================================================== +# Spring Boot Properties +# =================================================================== + +# IDENTITY (ContextIdApplicationContextInitializer) +spring.application.name=WebAnno + +# MULTIPART (MultipartProperties) +spring.http.multipart.max-file-size=100MB +spring.http.multipart.max-request-size=100MB + +spring.resources.cache-period=31536000 \ No newline at end of file diff --git a/webanno-webapp-exm/src/main/resources/log4j-deprecated.properties b/webanno-webapp-exm/src/main/resources/log4j-deprecated.properties deleted file mode 100644 index 67d420c..0000000 --- a/webanno-webapp-exm/src/main/resources/log4j-deprecated.properties +++ /dev/null @@ -1,33 +0,0 @@ -# -------------------------------------------------------------------------------------------------- -# Default production logging levels - -log4j.appender.Stdout=org.apache.log4j.ConsoleAppender -log4j.appender.Stdout.layout=org.apache.log4j.EnhancedPatternLayout -log4j.appender.Stdout.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%t] %X{_username}(%c{1}) - %m%n - -log4j.rootLogger=WARN,Stdout -log4j.logger.de.tudarmstadt=INFO -log4j.logger.org.springframework.beans.factory.config.PropertyPlaceholderConfigurer=ERROR -log4j.logger.org.springframework.beans.factory.config.PropertiesFactoryBean=ERROR - -#log4j.logger.de.tudarmstadt.ukp.clarin.webanno.webapp.WebAnnoPerformanceFilter=TRACE - -# -------------------------------------------------------------------------------------------------- -# Additional logging levels for debugging / during development - -#log4j.appender.Stdout.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %C{1}:%L - %m%n - -#log4j.logger.org.apache.wicket=INFO -#log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO -#log4j.logger.org.apache.wicket.version=INFO -#log4j.logger.org.apache.wicket.RequestCycle=INFO - -# See SQL statements -#log4j.logger.org.hibernate.SQL=TRACE - -# See values of parameters in prepared SQL statements -#log4j.logger.org.hibernate.type=trace - -#log4j.logger.org.springframework=TRACE - -log4j.logger.de.tudarmstadt.ukp.clarin.webanno.ui.annotation.AnnotationPage=DEBUG diff --git a/webanno-webapp-exm/src/main/resources/log4j2.xml b/webanno-webapp-exm/src/main/resources/log4j2.xml index c1b4a1f..15f4fe3 100644 --- a/webanno-webapp-exm/src/main/resources/log4j2.xml +++ b/webanno-webapp-exm/src/main/resources/log4j2.xml @@ -39,15 +39,9 @@ - - - - - + diff --git a/webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/resources/favicon.ico b/webanno-webapp-exm/src/main/resources/public/favicon.ico similarity index 100% rename from webanno-webapp-exm/src/main/java/de/tudarmstadt/ukp/clarin/webanno/webapp/resources/favicon.ico rename to webanno-webapp-exm/src/main/resources/public/favicon.ico diff --git a/webanno-webapp-exm/src/main/webapp/.gitignore b/webanno-webapp-exm/src/main/webapp/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/webanno-webapp-exm/src/main/webapp/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore