[java-identity-provider COMMIT] in /trunk/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filt...

noreply at shibboleth.net noreply at shibboleth.net
Sun Jan 19 09:02:02 EST 2014


Author: rdw
Date: Sun Jan 19 09:02:02 2014
New Revision: 5216

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5216&view=rev
Log:
IDP 354 Use builders rather than summoned up objects so as to allow property replacement.

Modified:
    trunk/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/basic/ScriptedMatcherParser.java
    trunk/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/matcher/BaseAttributeValueMatcherParser.java
    trunk/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/AttributeIssuerEntityAttributeRegexRuleParser.java

Modified: trunk/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/basic/ScriptedMatcherParser.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/basic/ScriptedMatcherParser.java?rev=5216&r1=5215&r2=5216&view=diff
==============================================================================
--- trunk/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/basic/ScriptedMatcherParser.java (original)
+++ trunk/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/basic/ScriptedMatcherParser.java Sun Jan 19 09:02:02 2014
@@ -22,7 +22,6 @@
 import java.util.List;
 
 import javax.annotation.Nonnull;
-import javax.script.ScriptException;
 import javax.xml.namespace.QName;
 
 import net.shibboleth.idp.attribute.filter.impl.matcher.ScriptedMatcher;
@@ -61,7 +60,7 @@
     private String logPrefix;
 
     /** {@inheritDoc} */
-    @Nonnull protected Class<?> getBeanClass(@Nonnull final Element element) {
+    @Override @Nonnull protected Class<?> getBeanClass(@Nonnull final Element element) {
         if (isPolicyRule(element)) {
             return ScriptedPolicyRule.class;
         }
@@ -104,7 +103,7 @@
     /**
      * {@inheritDoc} Both types of bean take the same constructor, so the parser is simplified.
      */
-    protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext,
+    @Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext,
             @Nonnull final BeanDefinitionBuilder builder) {
         super.doParse(config, parserContext, builder);
 
@@ -122,11 +121,9 @@
 
         final String script = getScript(config);
         log.debug("{} script: {}.", logPrefix, script);
-        try {
-            builder.addConstructorArgValue(new EvaluableScript(scriptLanguage, script));
-        } catch (ScriptException e) {
-            log.error("{} could not create the EvaluableScript : {}.", logPrefix, e);
-            throw new BeanCreationException("Scripted filter :'" + myId + "' Could not create the EvaluableScript");
-        }
+        BeanDefinitionBuilder scriptDefn = BeanDefinitionBuilder.genericBeanDefinition(EvaluableScript.class);
+        scriptDefn.addConstructorArgValue(scriptLanguage);
+        scriptDefn.addConstructorArgValue(script);
+        builder.addConstructorArgValue(scriptDefn.getBeanDefinition());
     }
 }

Modified: trunk/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/matcher/BaseAttributeValueMatcherParser.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/matcher/BaseAttributeValueMatcherParser.java?rev=5216&r1=5215&r2=5216&view=diff
==============================================================================
--- trunk/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/matcher/BaseAttributeValueMatcherParser.java (original)
+++ trunk/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/matcher/BaseAttributeValueMatcherParser.java Sun Jan 19 09:02:02 2014
@@ -66,7 +66,7 @@
     }
 
     /** {@inheritDoc} The table at the top describes the precise work. */
-    @Nonnull protected Class<?> getBeanClass(@Nonnull final Element element) {
+    @Override @Nonnull protected Class<?> getBeanClass(@Nonnull final Element element) {
         if (isPolicyRule(element)) {
             if (hasAttributeId(element)) {
                 return PolicyFromMatcherId.class;
@@ -85,7 +85,7 @@
     /**
      * Parse bean definition. If needs be we inject it into a parent bean (or two). {@inheritDoc}
      */
-    protected void doParse(@Nonnull final Element element, @Nonnull final ParserContext parserContext,
+    @Override protected void doParse(@Nonnull final Element element, @Nonnull final ParserContext parserContext,
             @Nonnull final BeanDefinitionBuilder builder) {
         super.doParse(element, parserContext, builder);
 
@@ -130,7 +130,7 @@
     @Nonnull protected abstract Class<?> getNativeBeanClass();
 
     /**
-     * Parse the native bean class. This is either called direct or then injected into the nesting class.

[... 23 lines stripped ...]


More information about the commits mailing list