[java-shib-attribute] branch main updated: JSSH-5 ServiceableComponent should implement AutoClose
Rod Widdowson
rdw at steadingsoftware.com
Sat Nov 26 14:46:04 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-shib-attribute.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-attribute.git;a=commit;h=55e00c48916f2ead63065a7c0e27676328a1fc8e
The following commit(s) were added to refs/heads/main by this push:
new 55e00c489 JSSH-5 ServiceableComponent should implement AutoClose
55e00c489 is described below
commit 55e00c48916f2ead63065a7c0e27676328a1fc8e
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Nov 26 13:45:04 2022 +0000
JSSH-5 ServiceableComponent should implement AutoClose
https://shibboleth.atlassian.net/browse/JSSH-5
AttributeTranscoderRegistryImpl is no longer a ServiceableComponent
---
.../impl/AttributeRegistryServiceStrategy.java | 7 ++++-
.../impl/AttributeTranscoderRegistryImpl.java | 31 ++++++++++++++++------
2 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/shib-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeRegistryServiceStrategy.java b/shib-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeRegistryServiceStrategy.java
index 79e22ee8b..0251c24e2 100644
--- a/shib-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeRegistryServiceStrategy.java
+++ b/shib-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeRegistryServiceStrategy.java
@@ -42,6 +42,7 @@ import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponen
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.service.ServiceException;
import net.shibboleth.shared.spring.service.AbstractServiceableComponent;
+import net.shibboleth.shared.spring.service.impl.SpringServiceableComponent;
/**
* Strategy for summoning up an {@link AttributeTranscoderRegistryImpl} from a populated {@link ApplicationContext}.
@@ -119,14 +120,18 @@ public class AttributeRegistryServiceStrategy extends AbstractIdentifiableInitia
registry.setNamingRegistry(namingRegistry);
registry.setExtendedConditionFactory(extendedConditionFactory);
registry.setTranscoderRegistry(holder);
+
+ final SpringServiceableComponent<AttributeTranscoderRegistry> result;
try {
registry.initialize();
+ result = new SpringServiceableComponent<>(registry);
+ result.initialize();
} catch (final ComponentInitializationException e) {
throw new ServiceException("Unable to initialize attribute transcoder registry for "
+ appContext.getDisplayName(), e);
}
- return registry;
+ return result;
}
}
diff --git a/shib-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeTranscoderRegistryImpl.java b/shib-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeTranscoderRegistryImpl.java
index ebc9efb84..71eb3f845 100644
--- a/shib-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeTranscoderRegistryImpl.java
+++ b/shib-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeTranscoderRegistryImpl.java
@@ -35,6 +35,7 @@ import org.opensaml.profile.context.ProfileRequestContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
@@ -47,16 +48,16 @@ import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.DeprecationSupport;
-import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
-import net.shibboleth.shared.spring.service.AbstractServiceableComponent;
+import net.shibboleth.shared.primitive.StringSupport;
/** Service implementation of the {@link AttributeTranscoderRegistry} interface. */
@ThreadSafe
-public class AttributeTranscoderRegistryImpl extends AbstractServiceableComponent<AttributeTranscoderRegistry>
- implements AttributeTranscoderRegistry {
+public class AttributeTranscoderRegistryImpl extends AbstractIdentifiableInitializableComponent
+ implements AttributeTranscoderRegistry, ApplicationContextAware {
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(AttributeTranscoderRegistryImpl.class);
@@ -76,6 +77,9 @@ public class AttributeTranscoderRegistryImpl extends AbstractServiceableComponen
/** Optional factory function for building extended activation conditions. */
@Nullable private Function<Map<String,Object>,Predicate<ProfileRequestContext>> extendedConditionFactory;
+ /** The context used to load this bean. */
+ @Nullable private ApplicationContext applicationContext;
+
/** Constructor. */
public AttributeTranscoderRegistryImpl() {
transcodingRegistry = new HashMap<>();
@@ -83,12 +87,23 @@ public class AttributeTranscoderRegistryImpl extends AbstractServiceableComponen
displayNameRegistry = new HashMap<>();
descriptionRegistry = new HashMap<>();
}
-
+
/** {@inheritDoc} */
- @Override @Nonnull public AttributeTranscoderRegistry getComponent() {
- return this;
+ @Override public void setApplicationContext(@Nullable final ApplicationContext context) {
+ checkSetterPreconditions();
+ applicationContext = context;
}
-
+
+ /**
+ * Get the context used to load this bean.
+ *
+ * @return the context.
+ */
+ @Nullable public ApplicationContext getApplicationContext() {
+ return applicationContext;
+ }
+
+
/**
* Installs registry of naming functions mapped against the types of objects they support.
*
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list