Refine search
protected boolean isDebugMode() { if (this.isDebugMode == null) { Boolean debugValue = false; if (configService != null) { Config global = configService.getGlobalConfig(); if (global != null) { ConfigElement flags = global.getConfigElement("flags"); if (flags != null) { ConfigElement clientDebug = flags.getChild("client-debug"); if (clientDebug != null) { debugValue = Boolean.valueOf(clientDebug.getValue()); } } } } this.isDebugMode = debugValue; } return this.isDebugMode; }
List<ConfigElement> uriElements = config.getChildren("uri-template"); if (uriElements != null) String template = uriElement.getValue(); if (template == null || template.trim().length() == 0)
/** * Adds a config element to the results of the lookup replacing any config * element already present with the same name * * @param configElement * The config element to add */ public void putConfigElement(ConfigElement configElement) { this.configElements.put(configElement.getName(), configElement); } }
Config configStandard = configService.getConfig(USED_STANDARD_CONFIG_CONDITION, clContext); && configStandard.getConfigElement(USED_STANDARD_ELEMENT) != null) standard = configStandard.getConfigElement(USED_STANDARD_ELEMENT).getValue(); Config configConditions = configService.getConfig(CONFIG_CONDITION, clContext); Map<String, ConfigElement> configElements = configConditions.getConfigElements(); logger.warn("Ignoring prefered standard doesn't found, choose : " + configLanguages.getName()); List<ConfigElement> languages = configLanguages.getChildren(); String code = convertToOldISOCode(langElem.getAttribute(ATTR_CODE)); String value = langElem.getValue(); String def = langElem.getAttribute(ATTR_DEFAULT);
Config securityHeadersConfig = (Config) configService.getConfig("SecurityHeadersPolicy"); if (securityHeadersConfig == null) ConfigElement headersConfig = securityHeadersConfig.getConfigElement("headers"); if (headersConfig == null) List<ConfigElement> headersConfigList = headersConfig.getChildren("header"); if (headersConfigList == null || headersConfigList.size() == 0) String name = headerConfig.getChildValue("name"); Header header; if (allHeaders.containsKey(name)) ConfigElement valueConfig = headerConfig.getChild("value"); if (valueConfig != null) header.setValue(valueConfig.getValue()); ConfigElement enabledConfig = headerConfig.getChild("enabled"); if (enabledConfig != null) String enabled = enabledConfig.getValue(); header.setEnabled(enabled == null || enabled.equalsIgnoreCase("true"));
Config csrfConfig = (Config) configService.getConfig("CSRFPolicy"); if (csrfConfig == null || !enabled) ConfigElement sessionConfig = csrfConfig.getConfigElement("session"); createSession = (sessionConfig != null && "true".equals(sessionConfig.getValue())); if (createSession && logger.isDebugEnabled()) logger.debug("The CSRFFilter will automatically create a user Session on a path match."); ConfigElement propertiesConfig = csrfConfig.getConfigElement("properties"); if (propertiesConfig != null) List<ConfigElement> propertiesConfigList = propertiesConfig.getChildren(); String value; if (propertiesConfigList != null && propertiesConfigList.size() > 0) value = propertyConfig.getValue(); properties.put(propertyConfig.getName(), value != null ? value : ""); ConfigElement filterConfig = csrfConfig.getConfigElement("filter"); if (filterConfig == null) List<ConfigElement> rulesConfigList = filterConfig.getChildren("rule"); if (rulesConfigList == null || rulesConfigList.size() == 0)
ConfigElement globalItem = globalSection.getConfigElement("global-item"); assertEquals("global-item", "The replaced global value", globalItem.getValue()); ConfigElement override = globalSection.getConfigElement("override"); assertNotNull("override should not be null", override); assertEquals("override element", "false", override.getValue()); ConfigElement childrenReplace = globalSection.getConfigElement("children-replace"); assertNotNull("childrenReplace should not be null", childrenReplace); List<ConfigElement> children = childrenReplace.getChildren(); assertEquals("number of children elements", 1, children.size()); assertEquals("custom child element value", "child custom value", customChild.getValue()); getConfigElement("first-item").getValue()); getConfigElement("second-item").getValue()); getConfigElement("fourth-item").getValue()); ConfigElement childrenElement = replaceTestCfg.getConfigElement("children"); assertEquals("number of children of children", 2, childrenElement.getChildCount()); assertEquals("child two name", "child-two", childrenElement.getChildren().get(0).getName()); assertEquals("child two value", "child two value", childrenElement.getChildren().get(0).getValue()); assertEquals("child three name", "child-three", childrenElement.getChildren().get(1).getName()); assertEquals("child three value", "child three value", childrenElement.getChildren().get(1).getValue());
public ConfigElement combine(ConfigElement configElement) combined.setValue(configElement.getValue()); String attrValue = configElement.getAttribute(attrName); combined.addAttribute(attrName, attrValue); if (configElement.getAttributes() != null) Iterator<String> attrs = configElement.getAttributes().keySet().iterator(); while (attrs.hasNext()) String attrValue = configElement.getAttribute(attrName); combined.addAttribute(attrName, attrValue); kids = configElement.getChildren(); if (kids != null)
ConfigElement requestConfig = ruleConfig.getChild("request"); if (requestConfig != null) rule.setMethod(resolve(requestConfig.getChildValue("method"))); rule.setPath(resolve(requestConfig.getChildValue("path"))); List<ConfigElement> headerConfigs = requestConfig.getChildren("header"); if (headerConfigs != null && headerConfigs.size() > 0) value = headerConfig.getValue(); headers.put(resolve(headerConfig.getAttribute("name")), resolve(value)); ConfigElement sessionConfig = requestConfig.getChild("session"); if (sessionConfig != null) List<ConfigElement> attributeConfigs = sessionConfig.getChildren("attribute"); if (attributeConfigs != null && attributeConfigs.size() > 0) value = attributeConfig.getValue(); sessionAttributes.put(resolve(attributeConfig.getAttribute("name")), resolve(value)); List<ConfigElement> actionConfigs = ruleConfig.getChildren("action"); if (actionConfigs != null && actionConfigs.size() > 0) actionName = resolve(actionConfig.getAttribute("name")); action = createAction(actionName); if (action == null)
ConfigElement children = cfg.getConfigElement("children"); assertEquals("There should be four children", 4, children.getChildCount()); ConfigElement childTwo = children.getChild("child-two"); assertNotNull("Child two config element should not be null", childTwo); assertEquals("Child two value should be 'child two value'", "child two value", childTwo.getValue()); assertEquals("The number of attributes should be 0", 0, childTwo.getAttributeCount()); ConfigElement noChild = children.getChild("not-there"); assertNull("The noChild config element should be null", noChild); ConfigElement childThree = children.getChild("child-three"); assertNotNull("Child three config element should not be null", childThree); ConfigElement grandKids = childThree.getChild("grand-children"); assertNotNull("Grand child config element should not be null", grandKids); assertEquals("There should be 2 grand child config elements", 2, grandKids.getChildCount()); ConfigElement grandKidOne = grandKids.getChild("grand-child-one"); assertNotNull("Grand child one config element should not be null", grandKidOne); assertEquals("The number of attributes for grand child one should be 1", 1, grandKidOne.getAttributeCount()); assertEquals("The number of children for grand child one should be 0", 0, grandKidOne.getChildCount()); assertTrue("The attribute 'an-attribute' should be present", grandKidOne.getAttribute("an-attribute") != null);
ConfigElement userMappings = params.getChild("userMappings"); if ( userMappings != null) List<ConfigElement> userMaps = userMappings.getChildren(); if ( userElem.getName().equalsIgnoreCase( "user")) String userName = userElem.getAttribute("name"); String uidStr = userElem.getAttribute("uid"); String gidStr = userElem.getAttribute("gid");
/** * @see org.springframework.extensions.config.Config#getConfigElementValue(java.lang.String) */ public String getConfigElementValue(String name) { ConfigElement ce = (ConfigElement)this.configElements.get(name); return ce != null ? ce.getValue() : null; }
ConfigElement globalItem = globalSection.getConfigElement("global-item"); assertNotNull("globalItem should not be null", globalItem); assertEquals("The global-item value should be 'The global value'", "The global value", globalItem.getValue()); ConfigElement clientElem = globalSection.getConfigElement("client"); assertNotNull(clientElem); ConfigElement fromAddressElem = clientElem.getChild("from-email-address"); assertNotNull(fromAddressElem); String fromAddress = fromAddressElem.getValue(); assertEquals("From address should be 'me@somewhere.net'", "me@somewhere.net", fromAddress);
List<ConfigElement> mappingElements = config.getChildren("uri-mapping"); if (mappingElements != null) String entry = mappingElement.getChildValue("url-entry"); if (entry == null || entry.trim().length() == 0) List<ConfigElement> templateElements = mappingElement.getChildren("uri-template"); if (templateElements.size() == 0) String template = templateElement.getValue(); if (template == null || template.trim().length() == 0)
ConfigElement overrideItem = globalSection.getConfigElement("override"); assertNotNull("overrideItem should not be null", overrideItem); assertEquals("The override item should be true", "true", overrideItem.getValue()); ConfigElement mergeChildren = globalSection.getConfigElement("merge-children"); assertNotNull("mergeChildren should not be null", mergeChildren); List<ConfigElement> kids = mergeChildren.getChildren(); assertEquals("There should be 2 children", 2, kids.size()); ConfigElement first = mergeTest.getConfigElement("first-item"); ConfigElement second = mergeTest.getConfigElement("second-item"); ConfigElement third = mergeTest.getConfigElement("third-item"); String firstValue = first.getValue(); assertEquals("The first value is wrong", "the overridden first value", firstValue); ConfigElement children = mergeTest.getConfigElement("children"); assertNotNull("children should not be null", children); kids = children.getChildren(); assertEquals("There should be 3 children", 3, kids.size());
ConfigElement globalItem = global.getConfigElement("global-item"); assertNotNull("globalItem should not be null", globalItem); assertEquals("The global-item value should be 'The global value'", "The global value", globalItem.getValue()); ConfigElement globalItemProp = global.getConfigElement("global-item-prop"); assertNotNull("globalItemProp should not be null", globalItemProp); assertEquals("The global-item value should be 'globalValue'", "globalValue", globalItemProp.getValue()); ConfigElement globalItemMissingProp = global.getConfigElement("global-item-missing-prop"); assertNotNull("globalItemMissingProp should not be null", globalItemMissingProp); assertEquals("The global-item value should be '${missingGlobalValue}'", "${missingGlobalValue}", globalItemMissingProp.getValue()); assertEquals("The override item should be false", "false", overrideItem.getValue()); assertEquals("The item value should be 'The value'", "The value", item.getValue()); assertEquals("The item value should be 'theValue'", "theValue", itemProp.getValue()); String attrValue = itemProp.getAttribute("item-attr"); assertNotNull("item attr should not be null", attrValue); assertEquals("The item value should be '${missingTheValue}'", "${missingTheValue}", itemMissingProp.getValue()); assertEquals("The override item should now be true", "true", overrideItem.getValue()); assertEquals("The override item should now be true", "true", overrideItem.getValue()); assertEquals("The override item should now be true", "${missingTrue}", overrideItemMissingProp.getValue());
String name = newConfigElement.getName(); ConfigElement existingConfigElement = results.getConfigElements().get(name); if (existingConfigElement != null) results.getConfigElements().put(name, newConfigElement); ConfigElement combinedConfigElement = existingConfigElement.combine(newConfigElement); results.getConfigElements().put(name, combinedConfigElement);
ConfigElement globalItem = global.getConfigElement("global-item"); assertNotNull("globalItem should not be null", globalItem); assertEquals("The global-item value should be 'The global value'", "The global value", globalItem.getValue()); ConfigElement overrideItem = global.getConfigElement("override"); assertNotNull("overrideItem should not be null", overrideItem); assertEquals("The override item should be false", "false", overrideItem.getValue()); ConfigElement item = unitTest.getConfigElement("item"); assertNotNull("item should not be null", item); assertEquals("The item value should be 'The value'", "The value", item.getValue()); overrideItem = unitTest.getConfigElement("override"); assertNotNull("overrideItem should not be null", overrideItem); assertEquals("The override item should now be true", "true", overrideItem.getValue());
ConfigElement storeElement = cfg.getChild(KEY_STORE); if (storeElement == null || storeElement.getValue() == null || storeElement.getValue().length() == 0) String storeValue = storeElement.getValue(); ConfigElement rootPathElement = cfg.getChild(KEY_ROOT_PATH); if (rootPathElement == null || rootPathElement.getValue() == null || rootPathElement.getValue().length() == 0) String rootPath = rootPathElement.getValue(); ConfigElement relativePathElement = cfg.getChild(KEY_RELATIVE_PATH); String relPath = relativePathElement.getValue().replace( '/', FileName.DOS_SEPERATOR); context.setRelativePath(relPath); ConfigElement urlFileElem = cfg.getChild( "urlFile"); if ( urlFileElem != null) ConfigElement pseudoName = urlFileElem.getChild( "filename"); context.setURLFileName(pseudoName.getValue()); ConfigElement offlineFiles = cfg.getChild( "offlineFiles"); if ( offlineFiles != null) if ( cfg.getChild("disableNodeMonitor") == null) { if ( cfg.getChild("disableOplocks") != null) { context.setDisableOplocks( true);