List of usage examples for org.w3c.dom Element getAttributeNS
public String getAttributeNS(String namespaceURI, String localName) throws DOMException;
From source file:net.gfipm.shibboleth.config.GfipmTestDataConnectorBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(String pluginId, Element pluginConfig, Map<QName, List<Element>> pluginConfigChildren, BeanDefinitionBuilder pluginBuilder, ParserContext parserContext) { super.doParse(pluginId, pluginConfig, pluginConfigChildren, pluginBuilder, parserContext); String userPath = pluginConfig.getAttributeNS(null, "pathToAttributeFiles"); String uidAttrName = pluginConfig.getAttributeNS(null, "uidAttribute"); pluginBuilder.addPropertyValue("pathToAttributeFiles", userPath); pluginBuilder.addPropertyValue("uidAttribute", uidAttrName); }
From source file:se.danetest.shibboleth.extension.DaneStaticExplicitKeySignatureTrustEngineBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { log.info("Parsing configuration for {} trust engine with id: {}", XMLHelper.getXSIType(element).getLocalPart(), element.getAttributeNS(null, "id")); List<Element> childElems = XMLHelper.getChildElementsByTagNameNS(element, DaneExplicitKeySignatureTrustEngineNamespaceHandler.NAMESPACE, "Credential"); builder.addPropertyValue("credentials", SpringConfigurationUtils.parseCustomElements(childElems, parserContext)); }
From source file:edu.internet2.middleware.shibboleth.common.config.attribute.filtering.match.basic.ScriptMatchFunctorBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element configElement, BeanDefinitionBuilder builder) { super.doParse(configElement, builder); String scriptLanguage = "javascript"; if (configElement.hasAttributeNS(null, "language")) { scriptLanguage = DatatypeHelper.safeTrimOrNullString(configElement.getAttributeNS(null, "language")); }/*from ww w .j av a 2 s. c om*/ builder.addConstructorArgValue(scriptLanguage); List<Element> scripts = XMLHelper.getChildElementsByTagNameNS(configElement, BasicMatchFunctorNamespaceHandler.NAMESPACE, "Script"); builder.addConstructorArgValue(DatatypeHelper.safeTrimOrNullString(scripts.get(0).getTextContent())); }
From source file:edu.internet2.middleware.shibboleth.common.config.metadata.HTTPMetadataProviderBeanDefinitionParser.java
/** * Sets the basic authentication properties, if any, for the HTTP client used to fetch metadata. * /*from w w w. j ava 2 s . c o m*/ * @param httpClient the HTTP client * @param config the metadata provider configuration * @param providerId the ID of the metadata provider * @param metadataURL the URL from which metadata will be fetched */ protected void setHttpBasicAuthSettings(HttpClient httpClient, Element config, String providerId, URL metadataURL) { String authUser = DatatypeHelper.safeTrimOrNullString(config.getAttributeNS(null, "basicAuthUser")); if (authUser == null) { return; } log.debug("Metadata provider '{}' HTTP Basic Auth username: {}", providerId, authUser); String authPassword = DatatypeHelper.safeTrimOrNullString(config.getAttributeNS(null, "basicAuthPassword")); log.debug("Metadata provider '{}' HTTP Basic Auth password not show", providerId); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(authUser, authPassword); AuthScope authScope = new AuthScope(metadataURL.getHost(), metadataURL.getPort()); httpClient.getState().setCredentials(authScope, credentials); }
From source file:de.betterform.agent.web.event.EventQueue.java
/** Adding XMLEvents to the EventQueue to be processed on the client * EventTarget is nulled to avoid sending it over the wire, targetName and targetId (received from EventTarget) * are stored instead in the ContextInfo Map * * @param event XMLEvent received from processor *///from w w w. j av a 2 s .c o m public void add(XMLEvent event) { try { XMLEvent clonedEvent = (XMLEvent) event.clone(); Element target = (Element) clonedEvent.getTarget(); clonedEvent.addProperty("targetId", target.getAttributeNS(null, "id")); String targetName = target.getLocalName(); clonedEvent.addProperty("targetName", targetName); if ((BetterFormEventNames.ITEM_CHANGED.equals(clonedEvent.getType()) || BetterFormEventNames.STATE_CHANGED.equals(clonedEvent.getType()) && HELPER_ELEMENTS.contains(targetName)) || BetterFormEventNames.PROTOTYPE_CLONED.equals(clonedEvent.getType()) || BetterFormEventNames.ITEM_DELETED.equals(clonedEvent.getType())) { // parent id is needed for updating all helper elements cause they // are identified by '<parentId>-label' etc. rather than their own id String parentId = ((Element) target.getParentNode()).getAttributeNS(null, "id"); clonedEvent.addProperty("parentId", parentId); } else if (BetterFormEventNames.STATE_CHANGED.equals(clonedEvent.getType()) && XFormsConstants.OUTPUT.equals(targetName) && XFormsConstants.LABEL.equals(target.getParentNode().getLocalName()) && XFormsConstants.TRIGGER.equals(target.getParentNode().getParentNode().getLocalName())) { // for outputs within labels of triggers add the trigger id as parentId and 'label' as targetName to the event String parentId = ((Element) target.getParentNode().getParentNode()).getAttributeNS(null, "id"); clonedEvent.addProperty("parentId", parentId); clonedEvent.addProperty("targetName", XFormsConstants.LABEL); } ((XercesXMLEvent) clonedEvent).target = null; ((XercesXMLEvent) clonedEvent).currentTarget = null; if (isLoadEmbedEvent(clonedEvent)) { this.loadEmbedEventList.add(clonedEvent); } else { this.eventList.add(clonedEvent); } } catch (CloneNotSupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.unitedid.shibboleth.config.attribute.resolver.dataConnector.MongoDbDataConnectorBeanDefinitionParser.java
/** * Parse mongodb connection entries// www.j a va 2 s . co m * * @param pluginId the id of this connector * @param pluginConfigChildren configuration elements * @return the server addresses extracted from mongohost elements */ protected List<ServerAddress> parseMongoHostNames(String pluginId, Map<QName, List<Element>> pluginConfigChildren) { List<ServerAddress> hosts = new ArrayList<ServerAddress>(); String host; int port; if (pluginConfigChildren.containsKey(HOST_ELEMENT_NAME)) { for (Element e : pluginConfigChildren.get(HOST_ELEMENT_NAME)) { host = DatatypeHelper.safeTrimOrNullString(e.getAttributeNS(null, "host")); try { if (e.hasAttributeNS(null, "port")) { port = Integer.parseInt(e.getAttributeNS(null, "port")); hosts.add(new ServerAddress(host, port)); } else { hosts.add(new ServerAddress(host)); } } catch (UnknownHostException err) { log.error("Data connector {} unknown host {}", pluginId, err); } } } return hosts; }
From source file:edu.internet2.middleware.psp.spring.GrouperNameFromLdapDnPSOIdentifierAttributeDefinitionBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(String pluginId, Element pluginConfig, Map<QName, List<Element>> pluginConfigChildren, BeanDefinitionBuilder pluginBuilder, ParserContext parserContext) { super.doParse(pluginId, pluginConfig, pluginConfigChildren, pluginBuilder, parserContext); String baseDn = pluginConfig.getAttributeNS(null, "baseDn"); LOG.debug("Setting baseDn of element '{}' to: '{}'", pluginConfig.getLocalName(), baseDn); pluginBuilder.addPropertyValue("baseDn", baseDn); String baseStem = pluginConfig.getAttributeNS(null, "baseStem"); LOG.debug("Setting baseStem of element '{}' to: '{}'", pluginConfig.getLocalName(), baseStem); pluginBuilder.addPropertyValue("baseStem", baseStem); }
From source file:edu.internet2.middleware.shibboleth.common.config.relyingparty.RelyingPartyGroupBeanDefinitionParser.java
/** {@inheritDoc} */ protected void doParse(Element config, ParserContext parserContext, BeanDefinitionBuilder builder) { Map<QName, List<Element>> configChildren = XMLHelper.getChildElements(config); List<Element> mds = configChildren.get(new QName(MetadataNamespaceHandler.NAMESPACE, "MetadataProvider")); if (mds != null && mds.size() > 0) { Element mdConfigElem = mds.get(0); SpringConfigurationUtils.parseCustomElement(mdConfigElem, parserContext); builder.addPropertyValue("metadataProvider", new RuntimeBeanReference(mdConfigElem.getAttributeNS(null, "id"))); }/* ww w .j a v a2s .com*/ parseRelyingPartyConfiguration(configChildren, builder, parserContext); parseSecurityConfiguration(configChildren, builder, parserContext); }
From source file:org.unitedid.shibboleth.config.attribute.resolver.dataConnector.MongoDbDataConnectorBeanDefinitionParser.java
/** * Parse mongodb Key entries//from w ww .j a v a 2 s.c om * * * @param pluginId the id of this connector * @param pluginConfigChildren configuration elements * @return the mongodb key attribute mappings */ protected List<MongoDbKeyAttributeMapper> parseAttributeMappings(String pluginId, Map<QName, List<Element>> pluginConfigChildren) { List<MongoDbKeyAttributeMapper> keyAttributeMaps = new ArrayList<MongoDbKeyAttributeMapper>(); MongoDbKeyAttributeMapper keyAttributeMap; String keyName; String attributeName; if (pluginConfigChildren.containsKey(KEY_ELEMENT_NAME)) { for (Element e : pluginConfigChildren.get(KEY_ELEMENT_NAME)) { keyName = DatatypeHelper.safeTrimOrNullString(e.getAttributeNS(null, "mongoKey")); attributeName = DatatypeHelper.safeTrimOrNullString(e.getAttributeNS(null, "attributeID")); keyAttributeMap = new MongoDbKeyAttributeMapper(keyName, attributeName); List<MongoDbKeyAttributeMapper> childMaps = new ArrayList<MongoDbKeyAttributeMapper>(); for (Element childElement : XMLHelper.getChildElementsByTagNameNS(e, UIDDataConnectorNamespaceHandler.NAMESPACE, "ValueMap")) { keyName = childElement.getAttributeNS(null, "mongoKey"); attributeName = childElement.getAttributeNS(null, "attributeID"); childMaps.add(new MongoDbKeyAttributeMapper(keyName, attributeName)); } if (childMaps.size() > 0) keyAttributeMap.setChildKeyAttributeMaps(childMaps); keyAttributeMaps.add(keyAttributeMap); } log.debug("Data connector {} key attribute maps: {}", pluginId, keyAttributeMaps); } return keyAttributeMaps; }
From source file:de.betterform.xml.xforms.action.SetFocusAction.java
/** * Performs element init.//from w w w . ja va2s . c om */ public void init() throws XFormsException { super.init(); // check if setfocus elem has NodeList childNodes = element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); if (NamespaceConstants.XFORMS_NS.equals(node.getNamespaceURI()) && node.getLocalName().equals("control") && node.getNodeType() == Node.ELEMENT_NODE) { Element elementImpl = (Element) node; XFormsElement xfElem = (XFormsElement) this.element.getUserData(""); if (elementImpl.hasAttributeNS(null, "value")) { String xpath = elementImpl.getAttributeNS(null, "value"); this.referencedControl = XPathCache.getInstance().evaluateAsString( xfElem.getModel().getDefaultInstance().getRootContext(), "string(" + xpath + ")"); } else { this.referencedControl = elementImpl.getTextContent(); } } } if (this.referencedControl == null) { this.referencedControl = getXFormsAttribute(CONTROL_ATTRIBUTE); } if (this.referencedControl == null) { throw new XFormsBindingException( "missing control attribute at " + DOMUtil.getCanonicalPath(this.getElement()), this.target, null); } }