[spring-extensions] branch main updated: JSPT-98 Integrate lifecycle checking methods in base classes

Rod Widdowson rdw at steadingsoftware.com
Sat Jul 16 10:29:48 UTC 2022


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository spring-extensions.

View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=0a36c92182d2c26e68b4d4ea3f6e6f79baf2d67c

The following commit(s) were added to refs/heads/main by this push:
     new 0a36c92  JSPT-98 Integrate lifecycle checking methods in base classes
0a36c92 is described below

commit 0a36c92182d2c26e68b4d4ea3f6e6f79baf2d67c
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Jul 15 16:16:55 2022 +0100

    JSPT-98 Integrate lifecycle checking methods in base classes
    
    https://shibboleth.atlassian.net/browse/JSPT-98
    
    rename methods
            throwSetterPreconditionExceptions -> checkSetterPreconditions
            throwComponentStateExceptions -> checkComponentActive
---
 .../ext/spring/resource/ConditionalResource.java   | 28 +++++++++++-----------
 .../ext/spring/resource/HTTPResource.java          |  2 +-
 .../service/AbstractServiceableComponent.java      |  2 +-
 .../ext/spring/service/LogbackLoggingService.java  |  6 ++---
 .../spring/service/ReloadableSpringService.java    | 14 +++++------
 5 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/src/main/java/net/shibboleth/ext/spring/resource/ConditionalResource.java b/src/main/java/net/shibboleth/ext/spring/resource/ConditionalResource.java
index c7e2624..c7f2d74 100644
--- a/src/main/java/net/shibboleth/ext/spring/resource/ConditionalResource.java
+++ b/src/main/java/net/shibboleth/ext/spring/resource/ConditionalResource.java
@@ -92,14 +92,14 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
      * @since 6.1.0
      */
     public void setDefaultContent(@Nonnull final String content) {
-        throwSetterPreconditionExceptions();
+        checkSetterPreconditions();
         
         defaultContent = Constraint.isNotEmpty(content, "Empty content cannot be null");
     }
 
     /** {@inheritDoc} */
     @Nonnull public InputStream getInputStream() throws IOException {
-        throwComponentStateExceptions();
+        checkComponentActive();
         
         try {
             return wrappedResource.getInputStream();
@@ -117,7 +117,7 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
     public net.shibboleth.utilities.java.support.resource.Resource createRelativeResource(final String relativePath)
             throws IOException {
         
-        throwComponentStateExceptions();
+        checkComponentActive();
         final Resource relative = wrappedResource.createRelative(relativePath);
         if (relative instanceof net.shibboleth.utilities.java.support.resource.Resource) {
             return (net.shibboleth.utilities.java.support.resource.Resource) relative;
@@ -133,7 +133,7 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
 
     /** {@inheritDoc} */
     public boolean exists() {
-        throwComponentStateExceptions();
+        checkComponentActive();
         
         try {
             if (!wrappedResource.exists()) {
@@ -147,21 +147,21 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
 
     /** {@inheritDoc} */
     public boolean isReadable() {
-        throwComponentStateExceptions();
+        checkComponentActive();
         
         return true;
     }
 
     /** {@inheritDoc} */
     public boolean isOpen() {
-        throwComponentStateExceptions();
+        checkComponentActive();
         
         return wrappedResource.isOpen();
     }
 
     /** {@inheritDoc} */
     public URL getURL() throws IOException {
-        throwComponentStateExceptions();
+        checkComponentActive();
         
         try {
             return wrappedResource.getURL();
@@ -175,7 +175,7 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
 
     /** {@inheritDoc} */
     public URI getURI() throws IOException {
-        throwComponentStateExceptions();
+        checkComponentActive();
         
         try {
             return wrappedResource.getURI();
@@ -189,7 +189,7 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
 
     /** {@inheritDoc} */
     public File getFile() throws IOException {
-        throwComponentStateExceptions();
+        checkComponentActive();
         
         try {
             return wrappedResource.getFile();
@@ -203,7 +203,7 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
 
     /** {@inheritDoc} */
     public long contentLength() throws IOException {
-        throwComponentStateExceptions();
+        checkComponentActive();
         
         try {
             return wrappedResource.contentLength();
@@ -217,7 +217,7 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
 
     /** {@inheritDoc} */
     public long lastModified() throws IOException {
-        throwComponentStateExceptions();
+        checkComponentActive();
         
         try {
             return wrappedResource.lastModified();
@@ -231,21 +231,21 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
 
     /** {@inheritDoc} */
     public Resource createRelative(final String relativePath) throws IOException {
-        throwComponentStateExceptions();
+        checkComponentActive();
         
         return wrappedResource.createRelative(relativePath);
     }
 
     /** {@inheritDoc} */
     public String getFilename() {
-        throwComponentStateExceptions();
+        checkComponentActive();
         
         return wrappedResource.getFilename();
     }
 
     /** {@inheritDoc} */
     public String getDescription() {
-        throwComponentStateExceptions();
+        checkComponentActive();
         
         return wrappedResource.getDescription();
     }
diff --git a/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java b/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java
index 6e2a574..d74e908 100644
--- a/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java
+++ b/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java
@@ -112,7 +112,7 @@ public class HTTPResource extends AbstractIdentifiedInitializableComponent imple
      * @since 5.4.0
      */
     public void setHttpClientContextHandler(@Nonnull final HttpClientContextHandler handler) {
-        throwSetterPreconditionExceptions();
+        checkSetterPreconditions();
         
         httpClientContextHandler = handler;
     }
diff --git a/src/main/java/net/shibboleth/ext/spring/service/AbstractServiceableComponent.java b/src/main/java/net/shibboleth/ext/spring/service/AbstractServiceableComponent.java
index 49e4ee1..e156da0 100644
--- a/src/main/java/net/shibboleth/ext/spring/service/AbstractServiceableComponent.java
+++ b/src/main/java/net/shibboleth/ext/spring/service/AbstractServiceableComponent.java
@@ -60,7 +60,7 @@ public abstract class AbstractServiceableComponent<T> extends AbstractIdentifiab
     
     /** {@inheritDoc} */
     @Override public void setApplicationContext(final ApplicationContext context) {
-        throwSetterPreconditionExceptions();
+        checkSetterPreconditions();
         applicationContext = context;
     }
 
diff --git a/src/main/java/net/shibboleth/ext/spring/service/LogbackLoggingService.java b/src/main/java/net/shibboleth/ext/spring/service/LogbackLoggingService.java
index ae510fb..d8ebb0b 100644
--- a/src/main/java/net/shibboleth/ext/spring/service/LogbackLoggingService.java
+++ b/src/main/java/net/shibboleth/ext/spring/service/LogbackLoggingService.java
@@ -76,7 +76,7 @@ public class LogbackLoggingService extends AbstractReloadableService<Object>
 
     /** {@inheritDoc} */
     public void setLoggingConfiguration(@Nonnull final Resource configuration) {
-        throwSetterPreconditionExceptions();
+        checkSetterPreconditions();
         configurationResource = Constraint.isNotNull(configuration, "Logging configuration resource cannot be null");
     }
     
@@ -86,7 +86,7 @@ public class LogbackLoggingService extends AbstractReloadableService<Object>
      * @param fallback fallback configuration resouurce
      */
     public void setFallbackConfiguration(@Nonnull final Resource fallback) {
-        throwSetterPreconditionExceptions();
+        checkSetterPreconditions();
         fallbackConfiguration = Constraint.isNotNull(fallback, "Logging configuration falback resource cannot be null");
     }
     
@@ -96,7 +96,7 @@ public class LogbackLoggingService extends AbstractReloadableService<Object>
      * @param name property name
      */
     public void setHomePropertyName(@Nullable @NotEmpty final String name) {
-        throwSetterPreconditionExceptions();
+        checkSetterPreconditions();
         homePropertyName = StringSupport.trimOrNull(name);
     }
 
diff --git a/src/main/java/net/shibboleth/ext/spring/service/ReloadableSpringService.java b/src/main/java/net/shibboleth/ext/spring/service/ReloadableSpringService.java
index a9a8794..d754d62 100644
--- a/src/main/java/net/shibboleth/ext/spring/service/ReloadableSpringService.java
+++ b/src/main/java/net/shibboleth/ext/spring/service/ReloadableSpringService.java
@@ -152,7 +152,7 @@ public class ReloadableSpringService<T> extends AbstractReloadableService<T> imp
      * @param context context that is the parent to this service's context, may be null
      */
     public void setParentContext(@Nullable final ApplicationContext context) {
-        throwSetterPreconditionExceptions();
+        checkSetterPreconditions();
 
         parentContext = context;
     }
@@ -174,7 +174,7 @@ public class ReloadableSpringService<T> extends AbstractReloadableService<T> imp
      * @param configs list of configurations for this service
      */
     public void setServiceConfigurations(@Nonnull @NonnullElements final List<Resource> configs) {
-        throwSetterPreconditionExceptions();
+        checkSetterPreconditions();
 
         serviceConfigurations = List.copyOf(Constraint.isNotNull(configs, "Service configurations cannot be null"));
         if (!serviceConfigurations.isEmpty()) {
@@ -209,7 +209,7 @@ public class ReloadableSpringService<T> extends AbstractReloadableService<T> imp
      * @param strategy the way to get the resources.  Precise details are tbd.
      */
     public void setServiceConfigurationStrategy(@Nonnull final Function<?, List<Resource>> strategy) {
-        throwSetterPreconditionExceptions();
+        checkSetterPreconditions();
         throw new UnsupportedOperationException("This UnsupportedOperationException method has not been implemented");
     }
 
@@ -220,7 +220,7 @@ public class ReloadableSpringService<T> extends AbstractReloadableService<T> imp
      */
     public void setBeanFactoryPostProcessors(
             @Nonnull @NonnullElements final List<BeanFactoryPostProcessor> processors) {
-        throwSetterPreconditionExceptions();
+        checkSetterPreconditions();
         Constraint.isNotNull(processors, "BeanFactoryPostProcessor collection cannot be null");
 
         factoryPostProcessors = List.copyOf(processors);
@@ -232,7 +232,7 @@ public class ReloadableSpringService<T> extends AbstractReloadableService<T> imp
      * @param processors bean post processors to apply
      */
     public void setBeanPostProcessors(@Nonnull @NonnullElements final List<BeanPostProcessor> processors) {
-        throwSetterPreconditionExceptions();
+        checkSetterPreconditions();
         Constraint.isNotNull(processors, "BeanPostProcessor collection cannot be null");
 
         postProcessors = List.copyOf(processors);
@@ -246,7 +246,7 @@ public class ReloadableSpringService<T> extends AbstractReloadableService<T> imp
      * @since 5.4.0
      */
     public void setBeanProfiles(@Nonnull @NonnullElements final Collection<String> profiles) {
-        throwSetterPreconditionExceptions();
+        checkSetterPreconditions();
         
         beanProfiles = StringSupport.normalizeStringCollection(profiles);
     }
@@ -259,7 +259,7 @@ public class ReloadableSpringService<T> extends AbstractReloadableService<T> imp
      * @since 5.4.0
      */
     public void setConversionService(@Nullable final ConversionService service) {
-        throwSetterPreconditionExceptions();
+        checkSetterPreconditions();
 
         conversionService = service;
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list