updates for tomee 8

This commit is contained in:
Peter Hormanns 2021-09-13 18:55:46 +02:00
parent df9986361f
commit ee21c742a4
11 changed files with 40 additions and 38 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>de.hsadmin</groupId> <groupId>de.hsadmin</groupId>
<artifactId>hsadmin-parent</artifactId> <artifactId>hsadmin-parent</artifactId>
<version>1.0.1</version> <version>1.0.2</version>
</parent> </parent>
<artifactId>cust-webapp</artifactId> <artifactId>cust-webapp</artifactId>
@ -74,14 +74,14 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version> <version>3.3.1</version>
<configuration> <configuration>
<archiveClasses>true</archiveClasses> <archiveClasses>true</archiveClasses>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<version>3.0.2</version> <version>3.2.0</version>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<configuration> <configuration>
<excludes> <excludes>
@ -107,7 +107,7 @@
<plugin> <plugin>
<groupId>org.apache.openjpa</groupId> <groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId> <artifactId>openjpa-maven-plugin</artifactId>
<version>2.4.2</version> <version>${openjpa.version}</version>
<configuration> <configuration>
<includes>**/bo/*.class</includes> <includes>**/bo/*.class</includes>
<addDefaultConstructor>true</addDefaultConstructor> <addDefaultConstructor>true</addDefaultConstructor>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>de.hsadmin</groupId> <groupId>de.hsadmin</groupId>
<artifactId>hsadmin-parent</artifactId> <artifactId>hsadmin-parent</artifactId>
<version>1.0.1</version> <version>1.0.2</version>
</parent> </parent>
<artifactId>framework</artifactId> <artifactId>framework</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>

View File

@ -59,10 +59,10 @@ public class ReflectionUtil {
public static Object newInstance(final Object anObject, String propertyName) throws TechnicalException { public static Object newInstance(final Object anObject, String propertyName) throws TechnicalException {
try { try {
final PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName, anObject.getClass()); final PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName, anObject.getClass());
final Object newInstance = propertyDescriptor.getReadMethod().getReturnType().newInstance(); final Object newInstance = propertyDescriptor.getReadMethod().getReturnType().getDeclaredConstructor().newInstance();
invokeSetter(anObject, propertyName, newInstance); invokeSetter(anObject, propertyName, newInstance);
return newInstance; return newInstance;
} catch (InstantiationException | IllegalAccessException | IntrospectionException | TechnicalException e) { } catch (InstantiationException | IllegalAccessException | IntrospectionException | TechnicalException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
throw new TechnicalException(e); throw new TechnicalException(e);
} }
} }

View File

@ -1,5 +1,7 @@
package de.hsadmin.login.cas; package de.hsadmin.login.cas;
import java.lang.reflect.InvocationTargetException;
import de.hsadmin.common.config.Config; import de.hsadmin.common.config.Config;
import de.hsadmin.common.error.TechnicalException; import de.hsadmin.common.error.TechnicalException;
import de.hsadmin.login.TicketValidator; import de.hsadmin.login.TicketValidator;
@ -12,8 +14,8 @@ public class TicketValidatorFactory {
try { try {
final String property = Config.getInstance().getProperty(Config.TICKETVALIDATOR_CLASS, "de.hsadmin.login.cas.CASTicketValidator"); final String property = Config.getInstance().getProperty(Config.TICKETVALIDATOR_CLASS, "de.hsadmin.login.cas.CASTicketValidator");
final Class<?> validatorClass = Class.forName(property); final Class<?> validatorClass = Class.forName(property);
ticketValidator = (TicketValidator) validatorClass.newInstance(); ticketValidator = (TicketValidator) validatorClass.getDeclaredConstructor().newInstance();
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
throw new TechnicalException(e); throw new TechnicalException(e);
} }
} }

View File

@ -131,8 +131,8 @@ public abstract class AbstractVO implements ValueObject {
final Mapping mapping = f.getAnnotation(Mapping.class); final Mapping mapping = f.getAnnotation(Mapping.class);
if (mapping != null && newInstance instanceof AbstractProperty<?>) { if (mapping != null && newInstance instanceof AbstractProperty<?>) {
AbstractProperty<?> prop = (AbstractProperty<?>) newInstance; AbstractProperty<?> prop = (AbstractProperty<?>) newInstance;
PersistentObjectMapper<?> persistentObjectMapper = mapping.boMapping().newInstance(); PersistentObjectMapper<?> persistentObjectMapper = mapping.boMapping().getDeclaredConstructor().newInstance();
ParameterMapMapper<?> parameterMapMapper = mapping.rpcMapping().newInstance(); ParameterMapMapper<?> parameterMapMapper = mapping.rpcMapping().getDeclaredConstructor().newInstance();
prop.setParameterMapMapper(parameterMapMapper); prop.setParameterMapMapper(parameterMapMapper);
prop.setPersistentObjectMapper(persistentObjectMapper); prop.setPersistentObjectMapper(persistentObjectMapper);
if (persistentObjectMapper instanceof ReferredPropertyPath) { if (persistentObjectMapper instanceof ReferredPropertyPath) {

View File

@ -26,8 +26,10 @@ public class DefaultEnumPersistentObjectMapper implements PersistentObjectMapper
throws TechnicalException, UserException { throws TechnicalException, UserException {
final Class<?> propertyClass = ReflectionUtil.getFieldType(persistentObject, propertyName); final Class<?> propertyClass = ReflectionUtil.getFieldType(persistentObject, propertyName);
@SuppressWarnings("rawtypes")
final Class<? extends Enum> aSubclass = propertyClass.asSubclass(Enum.class);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Enum<?> enumValue = Enum.valueOf(propertyClass.asSubclass(Enum.class), value); final Enum<?> enumValue = Enum.valueOf(aSubclass, value);
ReflectionUtil.invokeSetter(persistentObject, propertyName, enumValue); ReflectionUtil.invokeSetter(persistentObject, propertyName, enumValue);
} }
} }

View File

@ -1,5 +1,6 @@
package de.hsadmin.module.property.mapping; package de.hsadmin.module.property.mapping;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -46,7 +47,7 @@ public class DefaultListParameterMapMapper<VO extends ValueObject> implements Pa
if (list instanceof Object[]) { if (list instanceof Object[]) {
for (Object obj : (Object[])list) { for (Object obj : (Object[])list) {
if (obj instanceof Map<?, ?>) { if (obj instanceof Map<?, ?>) {
final VO vo = (VO) elementsType.newInstance(); final VO vo = (VO) elementsType.getDeclaredConstructor().newInstance();
final Map<?, ?> map = (Map<?, ?>) obj; final Map<?, ?> map = (Map<?, ?>) obj;
for (Object key : map.keySet()) { for (Object key : map.keySet()) {
if (key instanceof String) { if (key instanceof String) {
@ -58,7 +59,7 @@ public class DefaultListParameterMapMapper<VO extends ValueObject> implements Pa
} }
} }
} }
} catch (InstantiationException | IllegalAccessException e) { } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
throw new TechnicalException(e); throw new TechnicalException(e);
} }
return value; return value;

View File

@ -1,5 +1,6 @@
package de.hsadmin.module.property.mapping; package de.hsadmin.module.property.mapping;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -31,10 +32,10 @@ public class DefaultListPersistentObjectMapper<VO extends ValueObject> implement
final Collection<?> coll = (Collection<?>) object; final Collection<?> coll = (Collection<?>) object;
for (Object o : coll) { for (Object o : coll) {
try { try {
final VO newInstance = elementsType.newInstance(); final VO newInstance = elementsType.getDeclaredConstructor().newInstance();
newInstance.copyPropertiesFromPersistentObject(o); newInstance.copyPropertiesFromPersistentObject(o);
valueList.add(newInstance); valueList.add(newInstance);
} catch (InstantiationException | IllegalAccessException e) { } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
throw new TechnicalException(e); throw new TechnicalException(e);
} }
} }

View File

@ -1,6 +1,7 @@
package de.hsadmin.service.property; package de.hsadmin.service.property;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
@ -66,7 +67,7 @@ public class PropertyService extends AbstractModule<PropertyVO> implements Prope
continue; continue;
} }
final Class<?> serviceRemoteClass = Class.forName(remoteServicesProperties.getProperty(moduleName)); final Class<?> serviceRemoteClass = Class.forName(remoteServicesProperties.getProperty(moduleName));
final AbstractRemote<ValueObject> serviceRemote = (AbstractRemote<ValueObject>) serviceRemoteClass.newInstance(); final AbstractRemote<ValueObject> serviceRemote = (AbstractRemote<ValueObject>) serviceRemoteClass.getDeclaredConstructor().newInstance();
final ValueObject valueObject = serviceRemote.createValueObject(); final ValueObject valueObject = serviceRemote.createValueObject();
final Class<? extends ValueObject> voClass = valueObject.getClass(); final Class<? extends ValueObject> voClass = valueObject.getClass();
final List<Property<?>> propertiesList = valueObject.properties(); final List<Property<?>> propertiesList = valueObject.properties();
@ -113,7 +114,7 @@ public class PropertyService extends AbstractModule<PropertyVO> implements Prope
emptyList.add(vo); emptyList.add(vo);
} }
} }
} catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException e) { } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
throw new TechnicalException(e); throw new TechnicalException(e);
} }
return emptyList; return emptyList;

24
pom.xml
View File

@ -6,30 +6,30 @@
<groupId>de.hsadmin</groupId> <groupId>de.hsadmin</groupId>
<artifactId>hsadmin-parent</artifactId> <artifactId>hsadmin-parent</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.0.1</version> <version>1.0.2</version>
<name>HSAdmin Parent Project</name> <name>HSAdmin Parent Project</name>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hsadmin.version>1.0.1</hsadmin.version> <hsadmin.version>1.0.2</hsadmin.version>
<tomee.version>8.0.4</tomee.version> <tomee.version>8.0.8</tomee.version>
<servlet.version>4.0.1</servlet.version> <servlet.version>4.0.1</servlet.version>
<liquibase.version>4.1.1</liquibase.version> <liquibase.version>4.4.3</liquibase.version>
<openjpa.version>3.1.2</openjpa.version> <openjpa.version>3.2.0</openjpa.version>
<log4j.version>1.2.17</log4j.version> <log4j.version>1.2.17</log4j.version>
<xmlrpc.version>3.1.3</xmlrpc.version> <xmlrpc.version>3.1.3</xmlrpc.version>
<bval.version>2.0.4</bval.version> <bval.version>2.0.5</bval.version>
<postgresql.lib>org.postgresql:postgresql:42.2.18</postgresql.lib> <postgresql.lib>org.postgresql:postgresql:42.2.18</postgresql.lib>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
</properties> </properties>
<modules> <modules>
<module>db-migration</module> <module>db-migration</module>
<module>framework</module> <module>framework</module>
<module>ldap-services</module>
<!--
<module>cust-services</module> <module>cust-services</module>
<!--
<module>ldap-services</module>
<module>database-services</module> <module>database-services</module>
--> -->
<module>web</module> <module>web</module>
@ -40,12 +40,12 @@
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.11</version> <version>3.12.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.13.1</version> <version>4.13.2</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>de.hsadmin</groupId> <groupId>de.hsadmin</groupId>
<artifactId>hsadmin-parent</artifactId> <artifactId>hsadmin-parent</artifactId>
<version>1.0.1</version> <version>1.0.2</version>
</parent> </parent>
<artifactId>admin-web</artifactId> <artifactId>admin-web</artifactId>
@ -24,7 +24,7 @@
<dependency> <dependency>
<groupId>de.hsadmin</groupId> <groupId>de.hsadmin</groupId>
<artifactId>framework</artifactId> <artifactId>framework</artifactId>
<version>1.0.1</version> <version>${hsadmin.version}</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>org.apache.xmlrpc</groupId> <groupId>org.apache.xmlrpc</groupId>
@ -90,11 +90,6 @@
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgument></compilerArgument>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.tomcat.maven</groupId> <groupId>org.apache.tomcat.maven</groupId>