List of usage examples for org.w3c.dom Element getAttributeNS
public String getAttributeNS(String namespaceURI, String localName) throws DOMException;
From source file:edu.internet2.middleware.psp.spring.BaseSpmlProviderBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element configElement, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(configElement, parserContext, builder); String id = configElement.getAttributeNS(null, "id"); builder.addPropertyValue("id", id); if (configElement.hasAttributeNS(null, "logSpml")) { Attr attr = configElement.getAttributeNodeNS(null, "logSpml"); builder.addPropertyValue("logSpml", XMLHelper.getAttributeValueAsBoolean(attr)); }//from w w w . j a v a2s .c o m if (configElement.hasAttributeNS(null, "pathToOutputFile")) { String pathToOutputFile = configElement.getAttributeNS(null, "pathToOutputFile"); builder.addPropertyValue("pathToOutputFile", pathToOutputFile); } if (configElement.hasAttributeNS(null, "writeRequests")) { Attr attr = configElement.getAttributeNodeNS(null, "writeRequests"); builder.addPropertyValue("writeRequests", XMLHelper.getAttributeValueAsBoolean(attr)); } if (configElement.hasAttributeNS(null, "writeResponses")) { Attr attr = configElement.getAttributeNodeNS(null, "writeResponses"); builder.addPropertyValue("writeResponses", XMLHelper.getAttributeValueAsBoolean(attr)); } }
From source file:edu.internet2.middleware.psp.spring.PsoBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(element, builder); String id = element.getAttributeNS(null, "id"); builder.addPropertyValue("id", id); String authoritative = element.getAttributeNS(null, "authoritative"); builder.addPropertyValue("authoritative", authoritative); String allSourceIdentifiersRef = element.getAttributeNS(null, "allSourceIdentifiersRef"); builder.addPropertyValue("allSourceIdentifiersRef", allSourceIdentifiersRef); Map<QName, List<Element>> configChildren = XMLHelper.getChildElements(element); builder.addPropertyValue("psoIdentifier", SpringConfigurationUtils.parseInnerCustomElement( configChildren.get(PsoIdentifierBeanDefinitionParser.TYPE_NAME).get(0), parserContext)); if (configChildren.get(PsoIdentifyingAttributeBeanDefinitionParser.TYPE_NAME) != null) { builder.addPropertyValue("psoIdentifyingAttribute", SpringConfigurationUtils.parseInnerCustomElement( configChildren.get(PsoIdentifyingAttributeBeanDefinitionParser.TYPE_NAME).get(0), parserContext)); }/*from ww w. j a va 2 s. c o m*/ builder.addPropertyValue("psoAlternateIdentifiers", SpringConfigurationUtils.parseInnerCustomElements( configChildren.get(PsoAlternateIdentifierBeanDefinitionParser.TYPE_NAME), parserContext)); builder.addPropertyValue("psoAttributes", SpringConfigurationUtils.parseInnerCustomElements( configChildren.get(PsoAttributeBeanDefinitionParser.TYPE_NAME), parserContext)); builder.addPropertyValue("psoReferences", SpringConfigurationUtils.parseInnerCustomElements( configChildren.get(PsoReferencesBeanDefinitionParser.TYPE_NAME), parserContext)); }
From source file:edu.internet2.middleware.shibboleth.common.config.attribute.filtering.match.basic.AbstractRegexMatchFunctorBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element configElement, BeanDefinitionBuilder builder) { super.doParse(configElement, builder); builder.addPropertyValue("regularExpression", DatatypeHelper.safeTrimOrNullString(configElement.getAttributeNS(null, "regex"))); }
From source file:edu.internet2.middleware.shibboleth.common.config.security.MetadataExplicitKeySignatureTrustEngineBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element element, BeanDefinitionBuilder builder) { log.info("Parsing configuration for {} trust engine with id: {}", XMLHelper.getXSIType(element).getLocalPart(), element.getAttributeNS(null, "id")); builder.addPropertyReference("metadataProvider", DatatypeHelper.safeTrim(element.getAttributeNS(null, "metadataProviderRef"))); }
From source file:de.gwdg.shibboleth.config.attribute.resolver.dataConnector.MailmanDataConnectorBeanDefinitionParser.java
/** * Parse mailman Key entries//from ww w. j av a 2 s . c o m * * @param pluginId the id of this connector * @param pluginConfigChildren configuration elements * @param pluginBuilder the bean definition parser * @return the mailman key attribute mappings */ protected Map<String, String> parseAttributeMappings(String pluginId, Map<QName, List<Element>> pluginConfigChildren, BeanDefinitionBuilder pluginBuilder) { Map<String, String> attributeMapper = new HashMap<String, String>(); String keyName; String attributeName; if (pluginConfigChildren.containsKey(KEY_ELEMENT_NAME)) { for (Element e : pluginConfigChildren.get(KEY_ELEMENT_NAME)) { keyName = DatatypeHelper.safeTrimOrNullString(e.getAttributeNS(null, "mailmanKey")); attributeName = DatatypeHelper.safeTrimOrNullString(e.getAttributeNS(null, "attributeID")); attributeMapper.put(keyName, attributeName); } log.debug("Mailman connector {} key attribute maps: {}", pluginId, attributeMapper); } return attributeMapper; }
From source file:edu.internet2.middleware.psp.spring.LdapSpmlTargetBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element configElement, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(configElement, parserContext, builder); String ldapPoolId = configElement.getAttributeNS(null, "ldapPoolId"); LOG.debug("Setting ldapPoolId to '{}'", ldapPoolId); builder.addPropertyValue("ldapPoolId", ldapPoolId); String ldapPoolIdSource = configElement.getAttributeNS(null, "ldapPoolIdSource"); LOG.debug("Setting ldapPoolIdSource to '{}'", ldapPoolIdSource); builder.addPropertyValue("ldapPoolIdSource", ldapPoolIdSource); if (configElement.hasAttributeNS(null, "logLdif")) { Attr attr = configElement.getAttributeNodeNS(null, "logLdif"); LOG.debug("Setting logLdif to '{}'", XMLHelper.getAttributeValueAsBoolean(attr)); builder.addPropertyValue("logLdif", XMLHelper.getAttributeValueAsBoolean(attr)); }//from w w w .java 2 s.c om }
From source file:edu.internet2.middleware.shibboleth.common.config.attribute.filtering.BaseFilterBeanDefinitionParser.java
/** * Generates an ID for a filter engine component. If the given localId is null a random one will be generated. * /* ww w . j a va2 s. c o m*/ * @param configElement component configuration element * @param componentNamespace namespace for the component * @param localId local id or null * * @return unique ID for the componenent */ protected String getQualifiedId(Element configElement, String componentNamespace, String localId) { Element afpgElement = configElement.getOwnerDocument().getDocumentElement(); String policyGroupId = DatatypeHelper.safeTrimOrNullString(afpgElement.getAttributeNS(null, "id")); StringBuilder qualifiedId = new StringBuilder(); qualifiedId.append("/"); qualifiedId.append(AttributeFilterPolicyGroupBeanDefinitionParser.ELEMENT_NAME.getLocalPart()); qualifiedId.append(":"); qualifiedId.append(policyGroupId); if (!DatatypeHelper.isEmpty(componentNamespace)) { qualifiedId.append("/"); qualifiedId.append(componentNamespace); qualifiedId.append(":"); if (DatatypeHelper.isEmpty(localId)) { qualifiedId.append(idGen.generateIdentifier()); } else { qualifiedId.append(localId); } } return qualifiedId.toString(); }
From source file:edu.internet2.middleware.shibboleth.common.config.attribute.resolver.dataConnector.StaticDataConnectorBeanDefinitionParser.java
/** * Parses the configuration elements defining the static {@link BaseAttribute}s. * //from w w w . j a v a 2s . c o m * @param attributeElems configuration elements defining the static {@link BaseAttribute}s * * @return the static {@link BaseAttribute}s */ protected List<BaseAttribute<String>> processAttributes(List<Element> attributeElems) { if (attributeElems == null || attributeElems.size() == 0) { return null; } List<BaseAttribute<String>> attributes = new ArrayList<BaseAttribute<String>>(); BasicAttribute<String> attribute; for (Element attributeElem : attributeElems) { attribute = new BasicAttribute<String>( DatatypeHelper.safeTrimOrNullString(attributeElem.getAttributeNS(null, "id"))); for (Element valueElem : XMLHelper.getChildElementsByTagNameNS(attributeElem, DataConnectorNamespaceHandler.NAMESPACE, "Value")) { attribute.getValues().add(valueElem.getTextContent()); } attributes.add(attribute); } return attributes; }
From source file:edu.internet2.middleware.shibboleth.common.config.attribute.filtering.match.basic.AbstractStringMatchFunctorBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element configElement, BeanDefinitionBuilder builder) { super.doParse(configElement, builder); builder.addPropertyValue("matchString", DatatypeHelper.safeTrimOrNullString(configElement.getAttributeNS(null, "value"))); boolean ignoreCase = false; if (configElement.hasAttributeNS(null, "ignoreCase")) { ignoreCase = XMLHelper.getAttributeValueAsBoolean(configElement.getAttributeNodeNS(null, "ignoreCase")); }//from w ww . ja v a2s .com builder.addPropertyValue("caseSensitive", !ignoreCase); }
From source file:fi.okm.mpass.shibboleth.attribute.resolver.spring.dc.EcaAuthnIdDataConnectorParser.java
/** {@inheritDoc} */ protected void doV2Parse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { log.debug("Parsing the element"); String srcAttributeNames = element.getAttributeNS(null, "srcAttributeNames"); log.debug("Using srcAttributeNames={}", srcAttributeNames); builder.addPropertyValue("srcAttributeNames", srcAttributeNames); String destAttributeName = element.getAttributeNS(null, "destAttributeName"); log.debug("Using destAttributeName={}", destAttributeName); builder.addPropertyValue("destAttributeName", destAttributeName); String prefixSalt = StringSupport.trimOrNull(element.getAttributeNS(null, "prefixSalt")); log.debug("Using prefixSalt={}", prefixSalt); builder.addPropertyValue("prefixSalt", prefixSalt); String postfixSalt = StringSupport.trimOrNull(element.getAttributeNS(null, "postfixSalt")); log.debug("Using postfixSalt={}", postfixSalt); builder.addPropertyValue("postfixSalt", postfixSalt); String minInputLength = StringSupport.trimOrNull(element.getAttributeNS(null, "minInputLength")); log.debug("Using minInputLength={}", minInputLength); builder.addPropertyValue("minInputLength", minInputLength); String skipCalculation = StringSupport.trimOrNull(element.getAttributeNS(null, "skipCalculation")); log.debug("Using skipCalculation={}", skipCalculation); builder.addPropertyValue("skipCalculation", skipCalculation); String skipCalculationSrc = StringSupport.trimOrNull(element.getAttributeNS(null, "skipCalculationSrc")); log.debug("Using skipCalculationSrc={}", skipCalculationSrc); builder.addPropertyValue("skipCalculationSrc", skipCalculationSrc); }