View Javadoc

    1   /*
    2    * Copyright [2007] [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.idp.config.profile;
    18
    19  import java.util.List;
    20  import java.util.Map;
    21
    22  import javax.xml.namespace.QName;
    23
    24  import org.opensaml.xml.util.XMLHelper;
    25  import org.slf4j.Logger;
    26  import org.slf4j.LoggerFactory;
    27  import org.springframework.beans.factory.config.BeanDefinition;
    28  import org.springframework.beans.factory.xml.BeanDefinitionParser;
    29  import org.springframework.beans.factory.xml.ParserContext;
    30  import org.w3c.dom.Element;
    31
    32  import edu.internet2.middleware.shibboleth.common.config.SpringConfigurationUtils;
    33
    34  /** Spring bean definition parser for profile handler root element. */
    35  public class ProfileHandlerGroupBeanDefinitionParser implements BeanDefinitionParser {
    36
    37      /** Schema type name. */
    38      public static final QName SCHEMA_TYPE = new QName(ProfileHandlerNamespaceHandler.NAMESPACE, "ProfileHandlerGroup");
    39
    40      /** Class logger. */
    41      private static Logger log = LoggerFactory.getLogger(ProfileHandlerGroupBeanDefinitionParser.class);
    42
    43      /** {@inheritDoc} */
    44      public BeanDefinition parse(Element config, ParserContext context) {
    45          Map<QName, List<Element>> configChildren = XMLHelper.getChildElements(config);
    46          List<Element> children;
    47
    48          children = configChildren.get(new QName(ProfileHandlerNamespaceHandler.NAMESPACE, "ErrorHandler"));
    49          log.debug("{} error handler definitions found", children.size());
    50          SpringConfigurationUtils.parseInnerCustomElement(children.get(0), context);
    51
    52          children = configChildren.get(new QName(ProfileHandlerNamespaceHandler.NAMESPACE, "ProfileHandler"));
    53          log.debug("{} profile handler definitions found", children.size());
    54          SpringConfigurationUtils.parseInnerCustomElements(children, context);
    55
    56          children = configChildren.get(new QName(ProfileHandlerNamespaceHandler.NAMESPACE, "LoginHandler"));
    57          log.debug("{} login handler definitions found", children.size());
    58          SpringConfigurationUtils.parseInnerCustomElements(children, context);
    59
    60          return null;
    61      }
    62  }