[java-identity-provider COMMIT] in /trunk/idp-attribute-filter-impl/src: main/java/net/shibboleth/idp/attribute/filte...
noreply at shibboleth.net
noreply at shibboleth.net
Mon Aug 15 14:38:17 BST 2011
Author: rdw
Date: Mon Aug 15 14:38:17 2011
New Revision: 4015
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4015&view=rev
Log:
Syncrhonize the setters with initialize (for simpler code).
Make all "Boolean" matchers do Validation (and test)
Use helper classes for the destroy, validate & initialize
Added:
trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filtering/impl/matcher/DestroyableValidatableAttributeValueStringMatcher.java (contents, props changed)
- copied, changed from r4014, trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filtering/impl/matcher/DestroyableAttributeValueStringMatcher.java
Removed:
trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filtering/impl/matcher/DestroyableAttributeValueStringMatcher.java
Modified:
trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filtering/impl/matcher/AndMatcher.java
trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filtering/impl/matcher/NotMatcher.java
trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filtering/impl/matcher/OrMatcher.java
trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filtering/impl/matcher/TestAndMatcher.java
trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filtering/impl/matcher/TestNotMatcher.java
trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filtering/impl/matcher/TestOrMatcher.java
Modified: trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filtering/impl/matcher/AndMatcher.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filtering/impl/matcher/AndMatcher.java?rev=4015&r1=4014&r2=4015&view=diff
==============================================================================
--- trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filtering/impl/matcher/AndMatcher.java (original)
+++ trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filtering/impl/matcher/AndMatcher.java Mon Aug 15 14:38:17 2011
@@ -32,8 +32,11 @@
import org.opensaml.util.collections.CollectionSupport;
import org.opensaml.util.component.ComponentInitializationException;
+import org.opensaml.util.component.ComponentSupport;
+import org.opensaml.util.component.ComponentValidationException;
import org.opensaml.util.component.DestructableComponent;
import org.opensaml.util.component.InitializableComponent;
+import org.opensaml.util.component.ValidatableComponent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,7 +49,8 @@
* However it seems likely that such a constraint is erroneous...
*/
@ThreadSafe
-public class AndMatcher implements AttributeValueMatcher, InitializableComponent, DestructableComponent {
+public class AndMatcher implements AttributeValueMatcher, InitializableComponent, DestructableComponent,
+ ValidatableComponent {
/** Class logger. */
private final Logger log = LoggerFactory.getLogger(OrMatcher.class);
@@ -79,15 +83,13 @@
}
/** Mark the object as initialized having initialized any children. {@inheritDoc}. */
- public void initialize() throws ComponentInitializationException {
+ public synchronized void initialize() throws ComponentInitializationException {
if (initialized) {
- throw new ComponentInitializationException("And Matcher is initialized multiple times");
- }
+ throw new ComponentInitializationException("And Matcher being initialized multiple times");
+ }
+
for (AttributeValueMatcher matcher : matchers) {
- if (matcher instanceof InitializableComponent) {
- InitializableComponent init = (InitializableComponent) matcher;
- init.initialize();
- }
+ ComponentSupport.initialize(matcher);
}
initialized = true;
}
@@ -96,16 +98,28 @@
public void destroy() {
destroyed = true;
for (AttributeValueMatcher matcher : matchers) {
- if (matcher instanceof DestructableComponent) {
- DestructableComponent destructee = (DestructableComponent) matcher;
- destructee.destroy();
- }
+ ComponentSupport.destroy(matcher);
}
// Clear after the setting of the flag top avoid race with getMatchingValues
matchers = null;
}
/**
+ * Validate any validatable children.
+ * {@inheritDoc}
+ *
+ * @throws ComponentValidationException if any of the child validates failed.
+ */
+ public void validate() throws ComponentValidationException {
+ if (!initialized) {
+ throw new ComponentValidationException("Object not initialized");
+ }
+ for (AttributeValueMatcher matcher : matchers) {
+ ComponentSupport.validate(matcher);
+ }
+ }
+
+ /**
[... 530 lines stripped ...]
More information about the commits
mailing list