[java-identity-provider COMMIT] in /trunk: idp-conf/src/main/resources/system/conf/global-system.xml idp-core/src/mai...
noreply at shibboleth.net
noreply at shibboleth.net
Tue Feb 11 14:57:35 EST 2014
Author: tzeller
Date: Tue Feb 11 14:57:34 2014
New Revision: 5376
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5376&view=rev
Log:
IDP-368 : Set ID of a ReloadableSpringService automatically by implementing BeanNameAware and setting the ID to the bean name in doInitialize().
Modified:
trunk/idp-conf/src/main/resources/system/conf/global-system.xml
trunk/idp-core/src/main/java/net/shibboleth/idp/service/ReloadableSpringService.java
trunk/idp-core/src/test/java/net/shibboleth/idp/service/ReloadableSpringServiceTest.java
trunk/idp-core/src/test/resources/net/shibboleth/idp/service/ReloadableSpringService.xml
Modified: trunk/idp-conf/src/main/resources/system/conf/global-system.xml
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/main/resources/system/conf/global-system.xml?rev=5376&r1=5375&r2=5376&view=diff
==============================================================================
--- trunk/idp-conf/src/main/resources/system/conf/global-system.xml (original)
+++ trunk/idp-conf/src/main/resources/system/conf/global-system.xml Tue Feb 11 14:57:34 2014
@@ -130,7 +130,6 @@
<bean id="shibboleth.AttributeFilterService" class="net.shibboleth.idp.service.ReloadableSpringService" depends-on="shibboleth.VelocityEngine"
c:claz="net.shibboleth.idp.attribute.filter.AttributeFilter"
- p:id="shibboleth.AttributeFilterService"
p:serviceConfigurations-ref="shibboleth.AttributeFilterResources"
p:failFast="${idp.service.attribute.filter.failFast}"
p:reloadCheckDelay="${idp.service.attribute.filter.checkInterval}"
@@ -139,7 +138,6 @@
<bean id="shibboleth.AttributeResolverService" class="net.shibboleth.idp.service.ReloadableSpringService"
init-method="start" destroy-method="stop" depends-on="shibboleth.VelocityEngine"
c:claz="net.shibboleth.idp.attribute.resolver.AttributeResolver"
- p:id="shibboleth.AttributeResolverService"
p:serviceConfigurations-ref="shibboleth.AttributeResolverResources"
p:failFast="${idp.service.attribute.resolver.failFast}"
p:reloadCheckDelay="${idp.service.attribute.resolver.checkInterval}"
Modified: trunk/idp-core/src/main/java/net/shibboleth/idp/service/ReloadableSpringService.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-core/src/main/java/net/shibboleth/idp/service/ReloadableSpringService.java?rev=5376&r1=5375&r2=5376&view=diff
==============================================================================
--- trunk/idp-core/src/main/java/net/shibboleth/idp/service/ReloadableSpringService.java (original)
+++ trunk/idp-core/src/main/java/net/shibboleth/idp/service/ReloadableSpringService.java Tue Feb 11 14:57:34 2014
@@ -26,11 +26,13 @@
import javax.annotation.concurrent.ThreadSafe;
import net.shibboleth.idp.spring.SpringSupport;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.component.ComponentSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.FatalBeanException;
+import org.springframework.beans.factory.BeanNameAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.support.GenericApplicationContext;
@@ -46,7 +48,8 @@
* @param <T> The precise service being implemented.
*/
@ThreadSafe
-public class ReloadableSpringService<T> extends AbstractReloadableService implements ApplicationContextAware {
+public class ReloadableSpringService<T> extends AbstractReloadableService implements ApplicationContextAware,
+ BeanNameAware {
/** Class logger. */
private final Logger log = LoggerFactory.getLogger(ReloadableSpringService.class);
@@ -60,6 +63,9 @@
/** Application context owning this engine. */
private ApplicationContext parentContext;
+ /** The bean name. */
+ private String beanName;
+
/** The last known good component. */
private ServiceableComponent<T> cachedComponent;
@@ -309,4 +315,17 @@
public void setApplicationContext(ApplicationContext applicationContext) {
setParentContext(applicationContext);
}
+
+ /** {@inheritDoc} */
+ public void setBeanName(String name) {
+ beanName = name;
+ }
+
+ /** {@inheritDoc} */
+ protected void doInitialize() throws ComponentInitializationException {
+ if (getId() == null) {
+ setId(beanName);
+ }
+ super.doInitialize();
+ }
}
Modified: trunk/idp-core/src/test/java/net/shibboleth/idp/service/ReloadableSpringServiceTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-core/src/test/java/net/shibboleth/idp/service/ReloadableSpringServiceTest.java?rev=5376&r1=5375&r2=5376&view=diff
==============================================================================
[... 53 lines stripped ...]
More information about the commits
mailing list