/** * Add a global constant to the resource. * @param name The constant name. * @param value The constant value. */ public void addConstant(String name, String value) { if (getLog().isDebugEnabled()) { getLog().debug("Adding Global Constant: " + name + "," + value); } this.hConstants.put(name, value); }
/** * Add a <code>FormSet</code> to this <code>ValidatorResources</code> * object. It will be associated with the <code>Locale</code> of the * <code>FormSet</code>. * @param fs The form set to add. * @since Validator 1.1 */ public void addFormSet(FormSet fs) { String key = this.buildKey(fs); if (key.length() == 0) {// there can only be one default formset if (getLog().isWarnEnabled() && defaultFormSet != null) { // warn the user he might not get the expected results getLog().warn("Overriding default FormSet definition."); } defaultFormSet = fs; } else { FormSet formset = getFormSets().get(key); if (formset == null) {// it hasn't been included yet if (getLog().isDebugEnabled()) { getLog().debug("Adding FormSet '" + fs.toString() + "'."); } } else if (getLog().isWarnEnabled()) {// warn the user he might not // get the expected results getLog() .warn("Overriding FormSet definition. Duplicate for locale: " + key); } getFormSets().put(key, fs); } }
/** * Add a <code>ValidatorAction</code> to the resource. It also creates an * instance of the class based on the <code>ValidatorAction</code>s * classname and retrieves the <code>Method</code> instance and sets them * in the <code>ValidatorAction</code>. * @param va The validator action. */ public void addValidatorAction(ValidatorAction va) { va.init(); getActions().put(va.getName(), va); if (getLog().isDebugEnabled()) { getLog().debug("Add ValidatorAction: " + va.getName() + "," + va.getClassname()); } }
/** * Initialize the digester. */ private Digester initDigester() { URL rulesUrl = this.getClass().getResource(VALIDATOR_RULES); if (rulesUrl == null) { // Fix for Issue# VALIDATOR-195 rulesUrl = ValidatorResources.class.getResource(VALIDATOR_RULES); } if (getLog().isDebugEnabled()) { getLog().debug("Loading rules from '" + rulesUrl + "'"); } Digester digester = DigesterLoader.createDigester(rulesUrl); digester.setNamespaceAware(true); digester.setValidating(true); digester.setUseContextClassLoader(true); // Add rules for arg0-arg3 elements addOldArgRules(digester); // register DTDs for (int i = 0; i < REGISTRATIONS.length; i += 2) { URL url = this.getClass().getResource(REGISTRATIONS[i + 1]); if (url != null) { digester.register(REGISTRATIONS[i], url.toString()); } } return digester; }
/** * Add a global constant to the resource. * @param name The constant name. * @param value The constant value. */ public void addConstant(String name, String value) { if (getLog().isDebugEnabled()) { getLog().debug("Adding Global Constant: " + name + "," + value); } this.hConstants.put(name, value); }
/** * Add a global constant to the resource. * @param name The constant name. * @param value The constant value. */ public void addConstant(String name, String value) { if (getLog().isDebugEnabled()) { getLog().debug("Adding Global Constant: " + name + "," + value); } this.hConstants.put(name, value); }
/** * Add a <code>FormSet</code> to this <code>ValidatorResources</code> * object. It will be associated with the <code>Locale</code> of the * <code>FormSet</code>. * @param fs The form set to add. * @since Validator 1.1 */ public void addFormSet(FormSet fs) { String key = this.buildKey(fs); if (key.length() == 0) {// there can only be one default formset if (getLog().isWarnEnabled() && defaultFormSet != null) { // warn the user he might not get the expected results getLog().warn("Overriding default FormSet definition."); } defaultFormSet = fs; } else { FormSet formset = (FormSet) hFormSets.get(key); if (formset == null) {// it hasn't been included yet if (getLog().isDebugEnabled()) { getLog().debug("Adding FormSet '" + fs.toString() + "'."); } } else if (getLog().isWarnEnabled()) {// warn the user he might not // get the expected results getLog() .warn("Overriding FormSet definition. Duplicate for locale: " + key); } hFormSets.put(key, fs); } }
/** * Add a <code>FormSet</code> to this <code>ValidatorResources</code> * object. It will be associated with the <code>Locale</code> of the * <code>FormSet</code>. * @param fs The form set to add. * @since Validator 1.1 */ public void addFormSet(FormSet fs) { String key = this.buildKey(fs); if (key.length() == 0) {// there can only be one default formset if (getLog().isWarnEnabled() && defaultFormSet != null) { // warn the user he might not get the expected results getLog().warn("Overriding default FormSet definition."); } defaultFormSet = fs; } else { FormSet formset = getFormSets().get(key); if (formset == null) {// it hasn't been included yet if (getLog().isDebugEnabled()) { getLog().debug("Adding FormSet '" + fs.toString() + "'."); } } else if (getLog().isWarnEnabled()) {// warn the user he might not // get the expected results getLog() .warn("Overriding FormSet definition. Duplicate for locale: " + key); } getFormSets().put(key, fs); } }
/** * Add a <code>ValidatorAction</code> to the resource. It also creates an * instance of the class based on the <code>ValidatorAction</code>s * classname and retrieves the <code>Method</code> instance and sets them * in the <code>ValidatorAction</code>. * @param va The validator action. */ public void addValidatorAction(ValidatorAction va) { va.init(); getActions().put(va.getName(), va); if (getLog().isDebugEnabled()) { getLog().debug("Add ValidatorAction: " + va.getName() + "," + va.getClassname()); } }
/** * Add a <code>ValidatorAction</code> to the resource. It also creates an * instance of the class based on the <code>ValidatorAction</code>s * classname and retrieves the <code>Method</code> instance and sets them * in the <code>ValidatorAction</code>. * @param va The validator action. */ public void addValidatorAction(ValidatorAction va) { va.init(); this.hActions.put(va.getName(), va); if (getLog().isDebugEnabled()) { getLog().debug("Add ValidatorAction: " + va.getName() + "," + va.getClassname()); } }
/** * Initialize the digester. */ private Digester initDigester() { URL rulesUrl = this.getClass().getResource(VALIDATOR_RULES); if (rulesUrl == null) { // Fix for Issue# VALIDATOR-195 rulesUrl = ValidatorResources.class.getResource(VALIDATOR_RULES); } if (getLog().isDebugEnabled()) { getLog().debug("Loading rules from '" + rulesUrl + "'"); } Digester digester = DigesterLoader.createDigester(rulesUrl); digester.setNamespaceAware(true); digester.setValidating(true); digester.setUseContextClassLoader(true); // Add rules for arg0-arg3 elements addOldArgRules(digester); // register DTDs for (int i = 0; i < REGISTRATIONS.length; i += 2) { URL url = this.getClass().getResource(REGISTRATIONS[i + 1]); if (url != null) { digester.register(REGISTRATIONS[i], url.toString()); } } return digester; }
/** * Initialize the digester. */ private Digester initDigester() { URL rulesUrl = this.getClass().getResource(VALIDATOR_RULES); if (rulesUrl == null) { // Fix for Issue# VALIDATOR-195 rulesUrl = ValidatorResources.class.getResource(VALIDATOR_RULES); } if (getLog().isDebugEnabled()) { getLog().debug("Loading rules from '" + rulesUrl + "'"); } Digester digester = DigesterLoader.createDigester(rulesUrl); digester.setNamespaceAware(true); digester.setValidating(true); digester.setUseContextClassLoader(true); // Add rules for arg0-arg3 elements addOldArgRules(digester); // register DTDs for (int i = 0; i < REGISTRATIONS.length; i += 2) { URL url = this.getClass().getResource(REGISTRATIONS[i + 1]); if (url != null) { digester.register(REGISTRATIONS[i], url.toString()); } } return digester; }