This is an automated email from the ASF dual-hosted git repository. gk pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/turbine-core.git
commit 557dd58b8e8da7a5b08813f2ccfc168881658cd6 Author: Georg Kallidis <[email protected]> AuthorDate: Tue Nov 14 14:23:10 2023 +0100 Update changes.xml and javadoc, add debug logging --- src/changes/changes.xml | 9 +++++++++ src/java/org/apache/turbine/annotation/AnnotationProcessor.java | 2 +- .../turbine/services/FieldAnnotatedTurbineBaseService.java | 9 ++++++++- .../turbine/services/MethodAnnotatedTurbineBaseService.java | 4 +++- .../actions/VelocityActionWithExtendedServiceInjection.java | 2 +- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 9c009851..9db804c2 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -25,6 +25,15 @@ <body> <release version="5.2-SNAPSHOT" date="in Git"> + <action type="add" dev="gk"> + Provide mechanism to allow auto loading of Turbine (and Fulcrum) services. + If a "known" service is extending FieldAnnotatedTurbineBaseService and MethodAnnotatedTurbineBaseService this service could declare in fields and methods more Turbine services + either by annotating them with @TurbineService or autoload a service, which has class level annotation @TurbineService, if itself is annotated as TurbineService. + This allows for delegated calls to Turbine services. + </action> + <action type="add" dev="gk"> + New service DateTimeFormatterService and tool DateTimeFormatterTool, which allow date time formatting with locale and zone configuration. + </action> <action type="update" dev="gk"> Minor version update to Torque 5.1, Jackson to 2.14.0-rc2, docker-testcontainers to 1.17.5. </action> diff --git a/src/java/org/apache/turbine/annotation/AnnotationProcessor.java b/src/java/org/apache/turbine/annotation/AnnotationProcessor.java index ad5ad9f6..be1a1873 100644 --- a/src/java/org/apache/turbine/annotation/AnnotationProcessor.java +++ b/src/java/org/apache/turbine/annotation/AnnotationProcessor.java @@ -596,7 +596,7 @@ public class AnnotationProcessor if (StringUtils.isEmpty(serviceName)) { - // Try interface class name + // Try interface class name (e.g. used by Fulcrum) serviceName = field.getType().getName(); } diff --git a/src/java/org/apache/turbine/services/FieldAnnotatedTurbineBaseService.java b/src/java/org/apache/turbine/services/FieldAnnotatedTurbineBaseService.java index 11248d3f..b8037a44 100644 --- a/src/java/org/apache/turbine/services/FieldAnnotatedTurbineBaseService.java +++ b/src/java/org/apache/turbine/services/FieldAnnotatedTurbineBaseService.java @@ -1,5 +1,8 @@ package org.apache.turbine.services; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -25,7 +28,9 @@ import org.apache.turbine.util.TurbineException; /** * <p>This class provides a <code>Service</code> implementation that * Services used in Turbine are required to extend. - * This class provides the ability to process field annotation {@link TurbineServices} in a Turbine service. + * This class provides the ability to process field annotation {@link TurbineServices} in a Turbine service. + * You could enable scanning globally by annotating the class (service) with the annotation {@link TurbineServices}. + * Field annotation could then be omitted, if the field class is {@link TurbineServices} annotated. * </p> * */ @@ -33,6 +38,7 @@ public abstract class FieldAnnotatedTurbineBaseService extends TurbineBaseService { + private static Logger log = LogManager.getLogger(FieldAnnotatedTurbineBaseService.class); /** * Performs late initialization. * @@ -47,6 +53,7 @@ public abstract class FieldAnnotatedTurbineBaseService public void init() throws InitializationException { try { + log.debug("parsing annotations for {}", this.getClass()); AnnotationProcessor.process(this, false); } catch (TurbineException e) { throw new InitializationException(e.getMessage(), e); diff --git a/src/java/org/apache/turbine/services/MethodAnnotatedTurbineBaseService.java b/src/java/org/apache/turbine/services/MethodAnnotatedTurbineBaseService.java index 5fcd9212..97c0aba8 100644 --- a/src/java/org/apache/turbine/services/MethodAnnotatedTurbineBaseService.java +++ b/src/java/org/apache/turbine/services/MethodAnnotatedTurbineBaseService.java @@ -25,7 +25,9 @@ import org.apache.turbine.util.TurbineException; /** * <p>This class provides a <code>Service</code> implementation that * Services used in Turbine are required to extend. - * This class provides the ability to process field and method annotations {@link TurbineServices} in a Turbine service. + * This class provides the ability to process field and method annotations {@link TurbineServices} in a Turbine service. + * You could also enable scanning globally by annotating the class (service) with the annotation {@link TurbineServices}, + * then method annotation could be omitted, if the argument class is {@link TurbineServices} annotated. * </p> * */ diff --git a/src/test/org/apache/turbine/modules/actions/VelocityActionWithExtendedServiceInjection.java b/src/test/org/apache/turbine/modules/actions/VelocityActionWithExtendedServiceInjection.java index 0e3700cb..75a16f47 100644 --- a/src/test/org/apache/turbine/modules/actions/VelocityActionWithExtendedServiceInjection.java +++ b/src/test/org/apache/turbine/modules/actions/VelocityActionWithExtendedServiceInjection.java @@ -30,7 +30,7 @@ import org.apache.turbine.services.ServiceWithServiceInjection; import org.apache.velocity.context.Context; /** - * Annnotating even an assembler as TurbineService on class level we could omit annotations for dependent Turbine services. + * Annnotating even an assembler as TurbineService on class level we could omit annotations for fields if class is a Turbine service. */ @TurbineService public class VelocityActionWithExtendedServiceInjection extends VelocityAction
