View Javadoc

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