Skip to content

Commit

Permalink
Move to Spring 4 [WIP]
Browse files Browse the repository at this point in the history
Include depreacted SimpleFormController from Spring 3.2.18 by extracting
specific files with Maven depdendency plugin.

Update xsi:schemaLocations mentions to 4.3.

Update Hibernate to 4.3.11.

Update DWR to 3.0.2.
  • Loading branch information
arteymix committed Dec 4, 2022
1 parent 2bce979 commit ac20945
Show file tree
Hide file tree
Showing 26 changed files with 188 additions and 173 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">

<!-- Standard CLI tools -->
<context:component-scan base-package="ubic.gemma.core.apps"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
import org.aspectj.lang.annotation.Before;
import org.hibernate.*;
import org.hibernate.engine.spi.CascadeStyle;
import org.hibernate.engine.spi.CascadeStyles;
import org.hibernate.engine.spi.CascadingAction;
import org.hibernate.engine.spi.CascadingActions;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.type.Type;
import org.slf4j.Logger;
Expand Down Expand Up @@ -75,7 +77,7 @@ private enum OperationType {
/**
* Perform the audit advice on when entities are created.
* <p>
* This audit will cascade on {@link CascadeStyle#PERSIST}.
* This audit will cascade on {@link CascadeStyles#PERSIST}.
*
* @see Pointcuts#creator()
* @see ubic.gemma.persistence.service.BaseDao#create(Object)
Expand All @@ -89,7 +91,7 @@ public void doCreateAdvice( JoinPoint pjp ) {
/**
* Perform auditing when entities are updated.
* <p>
* This audit will cascade on {@link CascadeStyle#UPDATE}.
* This audit will cascade on {@link CascadeStyles#UPDATE}.
*
* @see Pointcuts#updater()
* @see ubic.gemma.persistence.service.BaseDao#update(Object)
Expand All @@ -103,8 +105,8 @@ public void doUpdateAdvice( JoinPoint pjp ) {
/**
* Perform auditing when entities are saved.
* <p>
* This audit will cascade on {@link CascadeStyle#PERSIST} if the audited entity is transient else
* {@link CascadeStyle#MERGE}.
* This audit will cascade on {@link CascadeStyles#PERSIST} if the audited entity is transient else
* {@link CascadeStyles#MERGE}.
*
* @see Pointcuts#saver()
* @see ubic.gemma.persistence.service.BaseDao#save(Object)
Expand All @@ -118,7 +120,7 @@ public void doSaveAdvice( JoinPoint pjp ) {
/**
* Perform auditing when entities are deleted.
* <p>
* This audit will cascade on {@link CascadeStyle#DELETE}.
* This audit will cascade on {@link CascadeStyles#DELETE}.
*
* @see Pointcuts#deleter()
* @see ubic.gemma.persistence.service.BaseDao#remove(Object)
Expand Down Expand Up @@ -180,18 +182,18 @@ private void processAuditable( Signature method, OperationType operationType, Au
*/
private void addCreateAuditEvent( Signature method, Auditable auditable, User user, Date date ) {
addAuditEvent( method, auditable, AuditAction.CREATE, "", user, date );
cascadeAuditEvent( method, AuditAction.CREATE, auditable, user, date, CascadingAction.PERSIST );
cascadeAuditEvent( method, AuditAction.CREATE, auditable, user, date, CascadingActions.PERSIST );
}

private void addSaveAuditEvent( Signature method, Auditable auditable, User user, Date date ) {
AuditAction auditAction;
CascadingAction cascadingAction;
if ( auditable.getId() != null ) {
auditAction = AuditAction.UPDATE;
cascadingAction = CascadingAction.MERGE;
cascadingAction = CascadingActions.MERGE;
} else {
auditAction = AuditAction.CREATE;
cascadingAction = CascadingAction.PERSIST;
cascadingAction = CascadingActions.PERSIST;
}
addAuditEvent( method, auditable, auditAction, "", user, date );
// we only propagate a CREATE event through cascade for entities that were created in the save
Expand All @@ -214,15 +216,15 @@ private void addUpdateAuditEvent( Signature method, Auditable auditable, User us
addAuditEvent( method, auditable, AuditAction.UPDATE, "", user, date );
// we only propagate a CREATE event through cascade for entities that were created in the update
// Note: CREATE events are skipped if the audit trail already contains one
cascadeAuditEvent( method, AuditAction.CREATE, auditable, user, date, CascadingAction.SAVE_UPDATE );
cascadeAuditEvent( method, AuditAction.CREATE, auditable, user, date, CascadingActions.SAVE_UPDATE );
}

private void addDeleteAuditEvent( Signature method, Auditable auditable, User user, Date date ) {
if ( auditable.getId() == null ) {
throw new IllegalArgumentException( String.format( "Transient instance passed to delete auditing [%s on %s by %s]", method, auditable, user.getUserName() ) );
}
addAuditEvent( method, auditable, AuditAction.DELETE, "", user, date );
cascadeAuditEvent( method, AuditAction.DELETE, auditable, user, date, CascadingAction.DELETE );
cascadeAuditEvent( method, AuditAction.DELETE, auditable, user, date, CascadingActions.DELETE );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class ObjectFilter {
*/
private static final ConfigurableConversionService conversionService = new GenericConversionService();

private static <T> void addConverter( Class<?> targetClass, Converter<String, T> converter ) {
private static <T> void addConverter( Class<T> targetClass, Converter<? super String, ? extends T> converter ) {
conversionService.addConverter( String.class, targetClass, converter );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">

<!-- This defines which classes are picked up by annotation-scanning for beans (e.g. @Component or @Service or @Repository
or @Controller). We exclude ubic.gemma.web here, it is brought in by gemma-servlet.xml. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd">
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd">

<!-- Enable AspectJ autoproxy -->
<aop:aspectj-autoproxy/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">
<!-- author: keshav -->

<!-- See LuceneEnvironment for documentation of these parameters -->
Expand Down Expand Up @@ -31,7 +30,7 @@
<property name="compass" ref="compassExpression"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -40,7 +39,7 @@
<property name="compass" ref="compassGene"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -49,7 +48,7 @@
<property name="compass" ref="compassArray"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -58,7 +57,7 @@
<property name="compass" ref="compassBibliographic"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -67,7 +66,7 @@
<property name="compass" ref="compassProbe"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -76,7 +75,7 @@
<property name="compass" ref="compassBiosequence"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -85,7 +84,7 @@
<property name="compass" ref="compassGeneSet"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -94,7 +93,7 @@
<property name="compass" ref="compassExperimentSet"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/util/spring-util-4.3.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd">
http://www.springframework.org/schema/aop/spring-aop-4.3.xsd">

<bean id="authenticationLoggerListener" class="org.springframework.security.authentication.event.LoggerListener"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">

<!-- Local tasks executor -->
<bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
Expand All @@ -20,9 +20,7 @@
are listed in a resource. If the resource is in your classpath, list in in 'locations'. Other config files can be added by
defining PropertiesConfiguration instances -->
<bean id="userPropertiesFileHandler" class="org.apache.commons.configuration2.io.FileHandler" init-method="load">
<constructor-arg index="0">
<ref local="userProperties"/>
</constructor-arg>
<constructor-arg index="0" ref="userProperties"/>
<property name="fileName" value="Gemma.properties"/>
</bean>

Expand All @@ -31,9 +29,7 @@
<bean id="configurationPropertyConfigurer"
class="ubic.gemma.persistence.util.CommonsConfigurationPropertyPlaceholderConfigurer"
depends-on="userPropertiesFileHandler">
<property name="configuration">
<ref local="userProperties"/>
</property>
<property name="configuration" ref="userProperties"/>
<property name="locations">
<list>
<value>classpath:default.properties</value>
Expand Down
2 changes: 1 addition & 1 deletion gemma-core/src/main/resources/ubic/gemma/dataSource.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">

<!-- Database connection information -->
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">

<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${gemma.testdb.driver}"/>
Expand Down
38 changes: 31 additions & 7 deletions gemma-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,30 @@
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.18.RELEASE</version>
</artifactItem>
</artifactItems>
<includes>org/springframework/web/servlet/mvc/AbstractFormController.class,org/springframework/web/servlet/mvc/BaseCommandController.class,org/springframework/web/servlet/mvc/SimpleFormController.class</includes>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand Down Expand Up @@ -198,7 +222,7 @@
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.1.4.RELEASE</version>
<version>2.4.7.RELEASE</version>
</dependency>

<!-- Apache Commons -->
Expand All @@ -224,19 +248,19 @@
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>1.8.6</version>
<version>2.3.2</version>
</dependency>

<!-- RSS feeds (depends on spring-web version) -->
<dependency>
<groupId>rome</groupId>
<groupId>com.rometools</groupId>
<artifactId>rome</artifactId>
<version>1.0</version>
<version>1.18.0</version>
</dependency>
<dependency>
<groupId>rome</groupId>
<groupId>com.rometools</groupId>
<artifactId>rome-fetcher</artifactId>
<version>1.0</version>
<version>1.18.0</version>
</dependency>

<!-- JSON -->
Expand All @@ -250,7 +274,7 @@
<dependency>
<groupId>org.directwebremoting</groupId>
<artifactId>dwr</artifactId>
<version>2.0.11-RELEASE</version>
<version>3.0.2-RELEASE</version>
</dependency>

<!-- Templating -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
package ubic.gemma.web.controller.common.rss;

import com.sun.syndication.feed.rss.Channel;
import com.sun.syndication.feed.rss.Content;
import com.sun.syndication.feed.rss.Item;
import com.rometools.rome.feed.rss.Channel;
import com.rometools.rome.feed.rss.Content;
import com.rometools.rome.feed.rss.Item;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
Expand Down
12 changes: 6 additions & 6 deletions gemma-web/src/main/java/ubic/gemma/web/feed/FeedReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
*/
package ubic.gemma.web.feed;

import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.fetcher.FeedFetcher;
import com.sun.syndication.fetcher.impl.FeedFetcherCache;
import com.sun.syndication.fetcher.impl.HashMapFeedInfoCache;
import com.sun.syndication.fetcher.impl.HttpURLFeedFetcher;
import com.rometools.fetcher.FeedFetcher;
import com.rometools.fetcher.impl.FeedFetcherCache;
import com.rometools.fetcher.impl.HashMapFeedInfoCache;
import com.rometools.fetcher.impl.HttpURLFeedFetcher;
import com.rometools.rome.feed.synd.SyndEntry;
import com.rometools.rome.feed.synd.SyndFeed;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Controller;
Expand Down
Loading

0 comments on commit ac20945

Please sign in to comment.