1 19 20 package com.sslexplorer.extensions; 21 22 import org.apache.commons.logging.Log; 23 import org.apache.commons.logging.LogFactory; 24 import org.jdom.Element; 25 import org.jdom.JDOMException; 26 27 import com.sslexplorer.boot.PropertyClassManager; 28 import com.sslexplorer.boot.PropertyDefinition; 29 import com.sslexplorer.boot.XMLPropertyDefinition; 30 31 44 public class ApplicationParameterDefinition extends XMLPropertyDefinition { 45 46 final static Log log = LogFactory.getLog(ApplicationParameterDefinition.class); 47 48 protected boolean optional; 50 51 57 public ApplicationParameterDefinition(Element element) throws JDOMException { 58 super(element); 59 60 if(element.getAttribute("sequence") != null) { 62 try { 63 log.warn("DEPRECATED. Application parameter definition element now user 'sortOrder' instead of 'sequence'."); 64 sortOrder = Integer.parseInt(element.getAttributeValue("sequence")); 65 } catch (Exception e) { 66 sortOrder = 0; 67 } 68 } 69 if(element.getAttribute("default") != null) { 70 log.warn("DEPRECATED. Application parameter definition element now user 'defaultValue' instead of 'default'."); 71 defaultValue = element.getAttributeValue("default"); 72 defaultValue = defaultValue == null ? PropertyDefinition.UNDEFINED_PARAMETER : defaultValue; 73 } 74 75 optional = "true".equalsIgnoreCase(element.getAttributeValue("optional")); 77 78 init(PropertyClassManager.getInstance().getPropertyClass(ApplicationParameters.NAME)); 80 } 81 82 87 public boolean isOptional() { 88 return optional; 89 } 90 91 } | Popular Tags |