This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 837f2a76863126e8fbe1fcb80440a0ef064cfa94
Author: Juan Pablo Santos Rodríguez <[email protected]>
AuthorDate: Thu Dec 2 22:52:24 2021 +0100

    Deprecate keys
    
    * jspwiki.attachmentProvider in favour of jspwiki.attachment.provider
    * jspwiki.attachmentProvider.adapter.impl in favour of 
jspwiki.attachment.provider.adapter.impl
---
 .../org/apache/wiki/providers/WikiAttachmentAdapterProvider.java   | 7 ++++---
 .../java/org/apache/wiki/providers/WikiProviderAdaptersTest.java   | 4 ++--
 .../main/java/org/apache/wiki/attachment/AttachmentManager.java    | 5 ++++-
 .../java/org/apache/wiki/attachment/DefaultAttachmentManager.java  | 2 +-
 .../java/org/apache/wiki/providers/CachingAttachmentProvider.java  | 2 +-
 jspwiki-main/src/main/resources/ini/jspwiki.properties             | 6 ++++--
 6 files changed, 16 insertions(+), 10 deletions(-)

diff --git 
a/jspwiki-210-adapters/src/main/java/org/apache/wiki/providers/WikiAttachmentAdapterProvider.java
 
b/jspwiki-210-adapters/src/main/java/org/apache/wiki/providers/WikiAttachmentAdapterProvider.java
index 28e78cc..f5b10f1 100644
--- 
a/jspwiki-210-adapters/src/main/java/org/apache/wiki/providers/WikiAttachmentAdapterProvider.java
+++ 
b/jspwiki-210-adapters/src/main/java/org/apache/wiki/providers/WikiAttachmentAdapterProvider.java
@@ -52,7 +52,8 @@ import java.util.stream.Collectors;
 public class WikiAttachmentAdapterProvider implements AttachmentProvider {
 
     private static final Logger LOG = LogManager.getLogger( 
WikiAttachmentAdapterProvider.class );
-    private static final String PROP_ADAPTER_IMPL = 
"jspwiki.attachmentProvider.adapter.impl";
+    private static final String PROP_ADAPTER_IMPL = 
"jspwiki.attachment.provider.adapter.impl";
+    @Deprecated private static final String PROP_ADAPTER_IMPL_DEPRECATED = 
"jspwiki.attachmentProvider.adapter.impl";
 
     WikiAttachmentProvider provider;
 
@@ -62,9 +63,9 @@ public class WikiAttachmentAdapterProvider implements 
AttachmentProvider {
         LOG.warn( "Using an attachment provider through 
org.apache.wiki.providers.WikiAttachmentAdapterProvider" );
         LOG.warn( "Please contact the attachment provider's author so there 
can be a new release of the provider " +
                   "implementing the new 
org.apache.wiki.api.providers.AttachmentProvider public API" );
-        final String classname = TextUtil.getRequiredProperty( properties, 
PROP_ADAPTER_IMPL );
+        final String classname = TextUtil.getRequiredProperty( properties, 
PROP_ADAPTER_IMPL, PROP_ADAPTER_IMPL_DEPRECATED );
         try {
-            LOG.debug( "Page provider class: '" + classname + "'" );
+            LOG.debug( "Page provider class: '{}'", classname );
             provider = ClassUtil.buildInstance( "org.apache.wiki.providers", 
classname );
         } catch( final ReflectiveOperationException e ) {
             LOG.error( "Could not instantiate {}", classname, e );
diff --git 
a/jspwiki-210-adapters/src/test/java/org/apache/wiki/providers/WikiProviderAdaptersTest.java
 
b/jspwiki-210-adapters/src/test/java/org/apache/wiki/providers/WikiProviderAdaptersTest.java
index bd9cab6..5b8d855 100644
--- 
a/jspwiki-210-adapters/src/test/java/org/apache/wiki/providers/WikiProviderAdaptersTest.java
+++ 
b/jspwiki-210-adapters/src/test/java/org/apache/wiki/providers/WikiProviderAdaptersTest.java
@@ -40,9 +40,9 @@ public class WikiProviderAdaptersTest {
 
     TestEngine engine = TestEngine.build( with( "jspwiki.cache.enable", 
"false" ),
                                           with( "jspwiki.pageProvider", 
"WikiPageAdapterProvider" ),
-                                          with( "jspwiki.attachmentProvider", 
"WikiAttachmentAdapterProvider" ),
                                           with( 
"jspwiki.pageProvider.adapter.impl", 
"com.example.providers.TwoXWikiPageProvider" ),
-                                          with( 
"jspwiki.attachmentProvider.adapter.impl", 
"com.example.providers.TwoXWikiAttachmentProvider" ) );
+                                          with( "jspwiki.attachment.provider", 
"WikiAttachmentAdapterProvider" ),
+                                          with( 
"jspwiki.attachment.provider.adapter.impl", 
"com.example.providers.TwoXWikiAttachmentProvider" ) );
 
     @Test
     public void testPageProvider() throws Exception {
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/attachment/AttachmentManager.java 
b/jspwiki-main/src/main/java/org/apache/wiki/attachment/AttachmentManager.java
index 7c4a228..c4a55b4 100644
--- 
a/jspwiki-main/src/main/java/org/apache/wiki/attachment/AttachmentManager.java
+++ 
b/jspwiki-main/src/main/java/org/apache/wiki/attachment/AttachmentManager.java
@@ -47,7 +47,10 @@ import java.util.List;
 public interface AttachmentManager {
 
     /** The property name for defining the attachment provider class name. */
-    String PROP_PROVIDER = "jspwiki.attachmentProvider";
+    String PROP_PROVIDER = "jspwiki.attachment.provider";
+
+    /** The property name for defining the attachment provider class name. */
+    @Deprecated String PROP_PROVIDER_DEPRECATED = "jspwiki.attachmentProvider";
 
     /** The maximum size of attachments that can be uploaded. */
     String PROP_MAXSIZE  = "jspwiki.attachment.maxsize";
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/attachment/DefaultAttachmentManager.java
 
b/jspwiki-main/src/main/java/org/apache/wiki/attachment/DefaultAttachmentManager.java
index decd26a..e0ccfb6 100644
--- 
a/jspwiki-main/src/main/java/org/apache/wiki/attachment/DefaultAttachmentManager.java
+++ 
b/jspwiki-main/src/main/java/org/apache/wiki/attachment/DefaultAttachmentManager.java
@@ -78,7 +78,7 @@ public class DefaultAttachmentManager implements 
AttachmentManager {
         if( cachingManager.enabled( CachingManager.CACHE_ATTACHMENTS_DYNAMIC ) 
) {
             classname = "org.apache.wiki.providers.CachingAttachmentProvider";
         } else {
-            classname = props.getProperty( PROP_PROVIDER );
+            classname = TextUtil.getRequiredProperty( props, PROP_PROVIDER, 
PROP_PROVIDER_DEPRECATED );
         }
 
         //  If no class defined, then will just simply fail.
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/providers/CachingAttachmentProvider.java
 
b/jspwiki-main/src/main/java/org/apache/wiki/providers/CachingAttachmentProvider.java
index fd67634..51fc644 100644
--- 
a/jspwiki-main/src/main/java/org/apache/wiki/providers/CachingAttachmentProvider.java
+++ 
b/jspwiki-main/src/main/java/org/apache/wiki/providers/CachingAttachmentProvider.java
@@ -70,7 +70,7 @@ public class CachingAttachmentProvider implements 
AttachmentProvider {
         // Find and initialize real provider.
         final String classname;
         try {
-            classname = TextUtil.getRequiredProperty( properties, 
AttachmentManager.PROP_PROVIDER );
+            classname = TextUtil.getRequiredProperty( properties, 
AttachmentManager.PROP_PROVIDER, AttachmentManager.PROP_PROVIDER_DEPRECATED );
         } catch( final NoSuchElementException e ) {
             throw new NoRequiredPropertyException( e.getMessage(), 
AttachmentManager.PROP_PROVIDER );
         }
diff --git a/jspwiki-main/src/main/resources/ini/jspwiki.properties 
b/jspwiki-main/src/main/resources/ini/jspwiki.properties
index 7a54fe7..5a8f9c4 100644
--- a/jspwiki-main/src/main/resources/ini/jspwiki.properties
+++ b/jspwiki-main/src/main/resources/ini/jspwiki.properties
@@ -122,7 +122,9 @@ jspwiki.cache.custom-config-file = jspwiki-ehcache.xml
 #    * Leave the value empty (or just comment the line out)
 #      the attachment functionality is disabled
 #
-jspwiki.attachmentProvider = BasicAttachmentProvider
+jspwiki.attachment.provider = BasicAttachmentProvider
+# This property superseedes
+#jspwiki.attachmentProvider = BasicAttachmentProvider (which has been thus 
deprecated)
 
 #
 #  The BasicAttachmentProvider needs to know where to store the files
@@ -869,7 +871,7 @@ mail.smtp.port = 25
 #
 #  Configure logs.  See log4j2 documentation for more information on how you 
can configure the logs.
 #
-#  By default we load the log4j2 config statements from this file (see below), 
unless
+#  By default, we load the log4j2 config statements from this file (see 
below), unless
 #  the property jspwiki.use.external.logconfig=true, in that case we let 
log4j2 figure out the
 #  logging configuration to use.
 #

Reply via email to