1 /* 2 * Copyright [2006] [University Corporation for Advanced Internet Development, Inc.] 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package edu.internet2.middleware.shibboleth.common.attribute.resolver.provider; 18 19 import java.util.Map; 20 21 import org.opensaml.xml.util.ValueTypeIndexedMap; 22 23 import edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attributeDefinition.AttributeDefinition; 24 import edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.dataConnector.DataConnector; 25 import edu.internet2.middleware.shibboleth.common.profile.provider.SAMLProfileRequestContext; 26 27 /** 28 * Contextual information for performing an attribute resolution. 29 */ 30 public class ShibbolethResolutionContext { 31 32 /** Attribute request context. */ 33 private SAMLProfileRequestContext requestContext; 34 35 /** Resolution plug-ins that have been resolved for this request. */ 36 private ValueTypeIndexedMap<String, ResolutionPlugIn> resolvedPlugins; 37 38 /** 39 * Constructor. 40 * 41 * @param context the attribute request this resolution is being performed for 42 */ 43 public ShibbolethResolutionContext(SAMLProfileRequestContext context) { 44 requestContext = context; 45 resolvedPlugins = new ValueTypeIndexedMap<String, ResolutionPlugIn>(ShibbolethAttributeResolver.PLUGIN_TYPES); 46 } 47 48 /** 49 * Gets the attribute request that started this resolution. 50 * 51 * @return attribute request that started this resolution 52 */ 53 public SAMLProfileRequestContext getAttributeRequestContext() { 54 return requestContext; 55 } 56 57 /** 58 * Get the resolution plug-ins that have been resolved for this request. 59 * 60 * @return the plug-ins that have been resolved for this request. 61 */ 62 public Map<String, ResolutionPlugIn> getResolvedPlugins() { 63 return resolvedPlugins; 64 } 65 66 /** 67 * Get an unmodifiable map of the attribute definitions that have been resolved for this request. To add new 68 * definitions, use {@link #getResolvedPlugins} to retrieve a modifiable collection. 69 * 70 * @return definitions that have been resolved for this request 71 */ 72 public Map<String, AttributeDefinition> getResolvedAttributeDefinitions() { 73 return resolvedPlugins.subMap(AttributeDefinition.class); 74 } 75 76 /** 77 * Get an unmodifiable map of the data connectors that have been resolved for this request. To add new connectors, 78 * use {@link #getResolvedPlugins} to retrieve a modifiable collection. 79 * 80 * @return connectors that have been resolved for this request 81 */ 82 public Map<String, DataConnector> getResolvedDataConnectors() { 83 return resolvedPlugins.subMap(DataConnector.class); 84 } 85 }