Tabnine Logo
Digester.getRules
Code IndexAdd Tabnine to your IDE (free)

How to use
getRules
method
in
org.apache.commons.digester.Digester

Best Java code snippets using org.apache.commons.digester.Digester.getRules (Showing top 20 results out of 315)

origin: commons-digester/commons-digester

/**
 * Return the namespace URI that will be applied to all subsequently
 * added <code>Rule</code> objects.
 */
public String getRuleNamespaceURI() {
  return (getRules().getNamespaceURI());
}
origin: commons-digester/commons-digester

/**
 * Set the namespace URI that will be applied to all subsequently
 * added <code>Rule</code> objects.
 *
 * @param ruleNamespaceURI Namespace URI that must match on all
 *  subsequently added rules, or <code>null</code> for matching
 *  regardless of the current namespace URI
 */
public void setRuleNamespaceURI(String ruleNamespaceURI) {
  getRules().setNamespaceURI(ruleNamespaceURI);
}
origin: commons-digester/commons-digester

/**
 * Return the set of rules that apply to the specified match position.
 * The selected rules are those that match exactly, or those rules
 * that specify a suffix match and the tail of the rule matches the
 * current match position.  Exact matches have precedence over
 * suffix matches, then (among suffix matches) the longest match
 * is preferred.
 *
 * @param match The current match position
 *
 * @deprecated Call <code>match()</code> on the <code>Rules</code>
 *  implementation returned by <code>getRules()</code>
 */
@Deprecated
List<Rule> getRules(String match) {
  return (getRules().match(match));
}
origin: commons-digester/commons-digester

/**
 * <p>Register a new Rule matching the specified pattern.
 * This method sets the <code>Digester</code> property on the rule.</p>
 *
 * @param pattern Element matching pattern
 * @param rule Rule to be registered
 */
public void addRule(String pattern, Rule rule) {
  rule.setDigester(this);
  getRules().add(pattern, rule);
}
origin: commons-digester/commons-digester

/**
 * This is only invoked after all child elements have been processed,
 * so we can remove the custom Rules object that does the 
 * child-element-matching.
 */
@Override
public void body(String bodyText) throws Exception {
  AnyChildRules newRules = (AnyChildRules) digester.getRules();
  digester.setRules(newRules.getOldRules());
}
origin: commons-digester/commons-digester

List<Rule> rules = getRules().match(namespaceURI, match);
matches.push(rules);
if ((rules != null) && (rules.size() > 0)) {
origin: commons-digester/commons-digester

/**
 * Process notification of the end of the document being reached.
 *
 * @exception SAXException if a parsing error is to be reported
 */
@Override
public void endDocument() throws SAXException {
  if (saxLog.isDebugEnabled()) {
    if (getCount() > 1) {
      saxLog.debug("endDocument():  " + getCount() +
             " elements left");
    } else {
      saxLog.debug("endDocument()");
    }
  }
  // Fire "finish" events for all defined rules
  for (Rule rule : getRules().rules()) {
    try {
      rule.finish();
    } catch (Exception e) {
      log.error("Finish event threw exception", e);
      throw createSAXException(e);
    } catch (Error e) {
      log.error("Finish event threw error", e);
      throw e;
    }
  }
  // Perform final cleanup
  clear();
}
origin: commons-digester/commons-digester

  /**
   * Creates an instance of the indicated class. The class must implement
   * the DigesterRulesSource interface. Passes the target digester to
   * that instance. The DigesterRulesSource instance is supposed to add
   * rules into the digester. The contents of the current pattern stack
   * will be automatically prepended to all of the pattern strings added
   * by the DigesterRulesSource instance.
   */
  private void includeProgrammaticRules(String className)
          throws ClassNotFoundException, ClassCastException,
          InstantiationException, IllegalAccessException {
    
    Class<?> cls = Class.forName(className);
    DigesterRulesSource rulesSource = (DigesterRulesSource) cls.newInstance();
    
    // wrap the digester's Rules object, to prepend pattern
    Rules digesterRules = targetDigester.getRules();
    Rules prefixWrapper =
        new RulesPrefixAdapter(patternStack.toString(), digesterRules);
    
    targetDigester.setRules(prefixWrapper);
    try {
      rulesSource.getRules(targetDigester);
    } finally {
      // Put the unwrapped rules back
      targetDigester.setRules(digesterRules);
    }
  }
}
origin: commons-digester/commons-digester

/**
 * Process the body text of this element.
 *
 * @param text The body text of this element
 */
@Override
public void body(String namespace, String name, String text)
  throws Exception {
  // While this class itself has no work to do in the body method,
  // we do need to fire the body methods of all dynamically-added
  // rules matching the same path as this rule. During begin, we had
  // to manually execute the dynamic rules' begin methods because they
  // didn't exist in the digester's Rules object when the match begin.
  // So in order to ensure consistent ordering of rule execution, the
  // PluginRules class deliberately avoids returning any such rules
  // in later calls to the match method, instead relying on this
  // object to execute them at the appropriate time.
  //
  // Note that this applies only to rules matching exactly the path
  // which is also matched by this PluginCreateRule. 
  String path = digester.getMatch();
  PluginRules newRules = (PluginRules) digester.getRules();
  List<Rule> rules = newRules.getDecoratedRules().match(namespace, path);
  fireBodyMethods(rules, namespace, name, text);
}
origin: commons-digester/commons-digester

newDecl.setProperties(props);
PluginRules rc = (PluginRules) digester.getRules();
PluginManager pm = rc.getPluginManager();
origin: commons-digester/commons-digester

/**
 * Process the beginning of this element.
 *
 * @param namespace is the namespace this attribute is in, or null
 * @param name is the name of the current xml element
 * @param attributes is the attribute list of this element
 */
@Override
public void begin(String namespace, String name, Attributes attributes) 
         throws Exception {
  Rules oldRules = digester.getRules();
  AnyChildRule anyChildRule = new AnyChildRule();
  anyChildRule.setDigester(digester);
  AnyChildRules newRules = new AnyChildRules(anyChildRule);
  newRules.init(digester.getMatch()+"/", oldRules);
  digester.setRules(newRules);
}

origin: commons-digester/commons-digester

PluginRules rules = (PluginRules) digester.getRules();
PluginManager pm = rules.getPluginManager();
origin: commons-digester/commons-digester

/**
 * Invoked by the digester when the closing tag matching this Rule's
 * pattern is encountered.
 * </p>
 * 
 * @param namespace Description of the Parameter
 * @param name Description of the Parameter
 * @exception Exception Description of the Exception
 *
 * @see #begin
 */
@Override
public void end(String namespace, String name)
        throws Exception {
  // see body method for more info
  String path = digester.getMatch();
  PluginRules newRules = (PluginRules) digester.getRules();
  List<Rule> rules = newRules.getDecoratedRules().match(namespace, path);
  fireEndMethods(rules, namespace, name);
  
  // pop the stack of PluginRules instances, which
  // discards all custom rules associated with this plugin
  digester.setRules(newRules.getParent());
  
  // and get rid of the instance of the plugin class from the
  // digester object stack.
  digester.pop();
}
origin: commons-digester/commons-digester

PluginRules oldRules = (PluginRules) digester.getRules();
PluginManager pluginManager = oldRules.getPluginManager();
Declaration currDeclaration = null;
origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * Return the namespace URI that will be applied to all subsequently
 * added <code>Rule</code> objects.
 */
public String getRuleNamespaceURI() {
  return (getRules().getNamespaceURI());
}
origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * Set the namespace URI that will be applied to all subsequently
 * added <code>Rule</code> objects.
 *
 * @param ruleNamespaceURI Namespace URI that must match on all
 *  subsequently added rules, or <code>null</code> for matching
 *  regardless of the current namespace URI
 */
public void setRuleNamespaceURI(String ruleNamespaceURI) {
  getRules().setNamespaceURI(ruleNamespaceURI);
}
origin: org.kuali.kfs/kfs-core

  /**
   * @return Rules loaded from the appropriate XML file
   */
  protected Rules loadRules(String digestorRulesFileName) {
    // locate Digester rules
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    URL rulesUrl = classLoader.getResource(digestorRulesFileName);
    if (rulesUrl == null) {
      throw new RuntimeException("unable to locate digester rules file " + digestorRulesFileName);
    }

    // create and init digester
    Digester digester = DigesterLoader.createDigester(rulesUrl);

    return digester.getRules();
  }
}
origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * This is only invoked after all child elements have been processed,
 * so we can remove the custom Rules object that does the 
 * child-element-matching.
 */
public void body(String bodyText) throws Exception {
  AnyChildRules newRules = (AnyChildRules) digester.getRules();
  digester.setRules(newRules.getOldRules());
}
origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * <p>Register a new Rule matching the specified pattern.
 * This method sets the <code>Digester</code> property on the rule.</p>
 *
 * @param pattern Element matching pattern
 * @param rule Rule to be registered
 */
public void addRule(String pattern, Rule rule) {
  rule.setDigester(this);
  getRules().add(pattern, rule);
}
origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * 结束处理, 弹出最近的context
 *
 * @throws Exception 如果失败
 */
@Override
public void end(String namespace, String name) throws Exception {
  ContextSensitiveRules rules = (ContextSensitiveRules) digester.getRules();
  String context = rules.popContext();
  if (context != null) {
    if (digester.getLogger().isDebugEnabled()) {
      digester.getLogger().debug("[SetContextRule]{" + digester.getMatch() + "} Pop " + context);
    }
  }
}
org.apache.commons.digesterDigestergetRules

Javadoc

Return the Rules implementation object containing our rules collection and associated matching policy. If none has been established, a default implementation will be created and returned.

Popular methods of Digester

  • parse
    Parse the content of the specified input source using this Digester. Returns the root element from t
  • addObjectCreate
    Add an "object create" rule for the specified parameters.
  • <init>
    Construct a new Digester, allowing an XMLReader to be passed in. This allows Digester to be used in
  • addSetNext
    Add a "set next" rule for the specified parameters.
  • push
    Pushes the given object onto the stack with the given name. If no stack already exists with the give
  • addSetProperties
    Add a "set properties" rule with overridden parameters. See SetPropertiesRule#SetPropertiesRule(Stri
  • addCallMethod
    Add an "call method" rule for the specified parameters. If paramCount is set to zero the rule will u
  • setValidating
    Set the validating parser flag. This must be called beforeparse() is called the first time.
  • addCallParam
    Add a "call parameter" rule. This will either take a parameter from the stack or from the current el
  • addRule
    Register a new Rule matching the specified pattern. This method sets the Digester property on the r
  • peek
    Gets the top object from the stack with the given name. This method does not remove the object from
  • setNamespaceAware
    Set the "namespace aware" flag for parsers we create.
  • peek,
  • setNamespaceAware,
  • addBeanPropertySetter,
  • setClassLoader,
  • setUseContextClassLoader,
  • register,
  • addRuleSet,
  • setEntityResolver,
  • pop,
  • setErrorHandler

Popular in Java

  • Reactive rest calls using spring rest template
  • setRequestProperty (URLConnection)
  • onRequestPermissionsResult (Fragment)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now