[java-identity-provider COMMIT] in /trunk: idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/r...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Jul 9 04:20:08 EDT 2014
Author: rdw
Date: Wed Jul 9 04:20:08 2014
New Revision: 6250
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6250&view=rev
Log:
IDP-429 Move creation of the Attribute Resolver ServiceableComponent into the service.
The AttributeResolver parser no longer populated a bean, rather it just parsers all the
content. The AttributeResolverServiceStrategy then grabs the definitions, data connectors
and principal connectors and creates an AttributeResolverImpl around them.
Test with two part resolver file.
Added:
trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverServiceStrategy.java
trunk/idp-conf/src/test/resources/mapping/configs/attribute-resolver2.xml
Modified:
trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverParser.java
trunk/idp-conf/src/main/resources/system/conf/services-system.xml
trunk/idp-conf/src/test/resources/mapping/configs/attribute-resolver.xml
trunk/idp-conf/src/test/resources/mapping/configs/override.xml
Modified: trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverParser.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverParser.java?rev=6250&r1=6249&r2=6250&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverParser.java (original)
+++ trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverParser.java Wed Jul 9 04:20:08 2014
@@ -20,27 +20,29 @@
import java.util.List;
import java.util.Map;
-import javax.annotation.Nullable;
import javax.xml.namespace.QName;
import net.shibboleth.ext.spring.util.SpringSupport;
-import net.shibboleth.idp.attribute.resolver.impl.AttributeResolverImpl;
import net.shibboleth.idp.attribute.resolver.spring.ad.BaseAttributeDefinitionParser;
import net.shibboleth.idp.attribute.resolver.spring.dc.AbstractDataConnectorParser;
-import net.shibboleth.idp.saml.attribute.principalconnector.impl.PrinicpalConnectorCanonicalizer;
-import net.shibboleth.utilities.java.support.primitive.StringSupport;
import net.shibboleth.utilities.java.support.xml.ElementSupport;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.w3c.dom.Element;
/**
* Bean definition parser for an {@link net.shibboleth.idp.attribute.resolver.AttributeResolver}. <br/>
- * This creates a {@link AttributeResolverImpl} from a <resolver:AttributeResolver> definition.
+ *
+ * There is no bean being summoned up here. Rather we just parse all the children. Then over in the service all the *
+ * {@link net.shibboleth.idp.attribute.resolver.AttributeDefinition},
+ * {@link net.shibboleth.idp.attribute.resolver.DataConnector} and
+ * {@link net.shibboleth.idp.saml.attribute.principalconnector.impl.PrincipalConnector} beans are sucked out of spring
+ * by type and injected into a new {@link net.shibboleth.idp.attribute.filter.AttributeFilterImpl} via a
+ * {@link AttributeResolverServiceStrategy}.
*/
-public class AttributeResolverParser extends AbstractSingleBeanDefinitionParser {
+public class AttributeResolverParser implements BeanDefinitionParser {
/** Element name. */
public static final QName ELEMENT_NAME =
@@ -50,46 +52,24 @@
public static final QName SCHEMA_TYPE = new QName(AttributeResolverNamespaceHandler.NAMESPACE,
"AttributeResolverType");
- /** {@inheritDoc} */
- @Override protected Class<AttributeResolverImpl> getBeanClass(@Nullable Element element) {
- return AttributeResolverImpl.class;
- }
-
- /** {@inheritDoc} */
- @Override protected void doParse(Element config, ParserContext context, BeanDefinitionBuilder builder) {
+ /**
+ * {@inheritDoc}
+ *
+ * @return
+ */
+ @Override public BeanDefinition parse(Element config, ParserContext context) {
final Map<QName, List<Element>> configChildren = ElementSupport.getIndexedChildElements(config);
List<Element> children;
- String id = StringSupport.trimOrNull(config.getAttributeNS(null, "id"));
-
- if (null == id) {
- // Compatibility with V2
- id = "Shibboleth.Resolver";
- }
- builder.setInitMethodName("initialize");
- builder.setDestroyMethodName("destroy");
-
- builder.addConstructorArgValue(id);
-
children = configChildren.get(BaseAttributeDefinitionParser.ELEMENT_NAME);
[... 112 lines stripped ...]
More information about the commits
mailing list