You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rd...@apache.org on 2003/11/16 23:37:35 UTC

cvs commit: jakarta-commons/digester/src/java/org/apache/commons/digester/plugins Declaration.java InitializableRule.java PluginCreateRule.java PluginDeclarationRule.java PluginManager.java PluginRules.java

rdonkin     2003/11/16 14:37:35

  Modified:    digester/src/java/org/apache/commons/digester/plugins
                        Declaration.java InitializableRule.java
                        PluginCreateRule.java PluginDeclarationRule.java
                        PluginManager.java PluginRules.java
  Log:
  Cosmetic changes to tidy up code formatting. Submitted by Simon Kitching.
  
  Revision  Changes    Path
  1.7       +72 -81    jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/Declaration.java
  
  Index: Declaration.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/Declaration.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Declaration.java	2 Nov 2003 23:26:59 -0000	1.6
  +++ Declaration.java	16 Nov 2003 22:37:35 -0000	1.7
  @@ -85,31 +85,31 @@
       public final static String DFLT_RULE_METHOD_NAME = "addRules";
      
       /** The class of the object to be instantiated. */
  -    private Class pluginClass_;
  +    private Class pluginClass;
   
       /** The name of the class of the object to be instantiated. */
  -    private String pluginClassName_;
  +    private String pluginClassName;
       
       /** See {@link #setId}. */ 
  -    private String id_;
  +    private String id;
       
       /** See {@link #setRuleMethod}. */
  -    private String ruleMethodName_ = DFLT_RULE_METHOD_NAME;
  +    private String ruleMethodName = DFLT_RULE_METHOD_NAME;
       
       /** See {@link #setRuleClass}. */ 
  -    private Class ruleClass_;
  +    private Class ruleClass;
       
       /** See {@link #setRuleResource}. */
  -    private String ruleResource_;
  +    private String ruleResource;
       
       /** See {@link #setRuleFile}. */
  -    private File ruleFile_;
  +    private File ruleFile;
       
       /** See {@link #setAutoSetProperties}. */
  -    private boolean autoSetProperties_ = true;
  +    private boolean autoSetProperties = true;
   
       /** See {@link #init}. */
  -    private boolean initialised_ = false;
  +    private boolean initialized = false;
       
       //---------------------- constructors ----------------------------------
   
  @@ -117,15 +117,15 @@
        * Constructor.
        */
       public Declaration(Class pluginClass) {
  -        pluginClass_ = pluginClass;
  -        pluginClassName_ = pluginClass_.getName();
  +        this.pluginClass = pluginClass;
  +        this.pluginClassName = pluginClass.getName();
       }
       
       /**
        * Constructor.
        */
       public Declaration(String pluginClassName) {
  -        pluginClassName_ = pluginClassName;
  +        this.pluginClassName = pluginClassName;
       }
       
       //---------------------- properties -----------------------------------
  @@ -135,14 +135,14 @@
        * For plugins declared "in-line", the id is null.
        */
       public void setId(String id) {
  -        id_ = id;
  +        this.id = id;
       }
       
       /** 
        * Sets the name of a method which defines custom rules. May be null. 
        */
       public void setRuleMethod(String ruleMethodName) {
  -        ruleMethodName_ = ruleMethodName;
  +        this.ruleMethodName = ruleMethodName;
       }
       
       /** 
  @@ -150,7 +150,7 @@
        * for the plugin class. May be null. 
        */
       public void setRuleClass(Class ruleClass) {
  -        ruleClass_ = ruleClass;
  +        this.ruleClass = ruleClass;
       }
       
       /**
  @@ -158,7 +158,7 @@
        * specifications of custom rules for the plugin class. May be null.
        */
       public void setRuleResource(String ruleResource) {
  -        ruleResource_ = ruleResource;
  +        this.ruleResource = ruleResource;
       }
       
       /**
  @@ -166,12 +166,12 @@
        * for the plugin class. May be null.
        */
       public void setRuleFile(File ruleFile) {
  -        ruleFile_ = ruleFile;
  +        this.ruleFile = ruleFile;
       }
       
       /** See {@link #autoSetProperties}. */
       public void setAutoSetProperties(boolean autoSetProperties) {
  -        autoSetProperties_ = autoSetProperties;
  +        this.autoSetProperties = autoSetProperties;
       }
       
       /**
  @@ -180,7 +180,7 @@
        * @return The id value. May be null.
        */
       public String getId() {
  -        return id_;
  +        return id;
       }
   
       /**
  @@ -189,7 +189,7 @@
        * @return The pluginClass.
        */
       public Class getPluginClass() {
  -        return pluginClass_;
  +        return pluginClass;
       }
   
       /**
  @@ -198,7 +198,7 @@
        * @return The ruleClass value. May be null.
        */
       public Class getRuleClass() {
  -        return ruleClass_;
  +        return ruleClass;
       }
   
       /**
  @@ -212,7 +212,7 @@
        * @return true if SetPropertiesRule is automatically applied.
        */
       public boolean autoSetProperties() {
  -        return autoSetProperties_;
  +        return autoSetProperties;
       }
   
       //---------------------- methods -----------------------------------
  @@ -221,30 +221,28 @@
        * Must be called exactly once, and must be called before any call
        * to the configure method.
        */
  -    public void init(Digester digester)
  -    throws PluginWrappedException {
  +    public void init(Digester digester) throws PluginWrappedException {
           Log log = digester.getLogger();
           boolean debug = log.isDebugEnabled();
           if (debug) {
               log.debug("init being called!");
           }
           
  -        if (initialised_) {
  +        if (initialized) {
               throw new PluginAssertionFailure("Init called multiple times.");
           }
   
  -        if ((pluginClass_ == null) && (pluginClassName_ != null)) {
  +        if ((pluginClass == null) && (pluginClassName != null)) {
               try {
                   // load the plugin class object
  -                pluginClass_ = 
  -                    digester.getClassLoader().loadClass(pluginClassName_);
  -            }
  -            catch(ClassNotFoundException cnfe) {
  +                pluginClass = 
  +                    digester.getClassLoader().loadClass(pluginClassName);
  +            } catch(ClassNotFoundException cnfe) {
                   throw new PluginWrappedException(
  -                    "Unable to load class " + pluginClassName_, cnfe);
  +                    "Unable to load class " + pluginClassName, cnfe);
               }
           }
  -        initialised_ = true;        
  +        initialized = true;        
       }
       
       /**
  @@ -293,36 +291,35 @@
        */
        
       public void configure(Digester digester, String pattern)
  -    throws PluginWrappedException {
  +                          throws PluginWrappedException {
           Log log = digester.getLogger();
           boolean debug = log.isDebugEnabled();
           if (debug) {
               log.debug("configure being called!");
           }
           
  -        if (!initialised_) {
  -            throw new PluginAssertionFailure("Not initialised.");
  +        if (!initialized) {
  +            throw new PluginAssertionFailure("Not initialized.");
           }
           
           // load from explicit file
  -        if (ruleFile_ != null) {
  +        if (ruleFile != null) {
               InputStream is = null;
               try {
  -                is = new FileInputStream(ruleFile_);
  -            }
  -            catch(IOException ioe) {
  +                is = new FileInputStream(ruleFile);
  +            } catch(IOException ioe) {
                   throw new PluginWrappedException(
  -                    "Unable to process file [" + ruleFile_ + "]", ioe);
  +                    "Unable to process file [" + ruleFile + "]", ioe);
               }
               loadRulesFromStream(is, digester, pattern);
               return;
           }
           
           // load from explicit resource in classpath
  -        if (ruleResource_ != null) {
  +        if (ruleResource != null) {
               InputStream is = 
  -                pluginClass_.getClassLoader().getResourceAsStream(
  -                    ruleResource_);
  +                pluginClass.getClassLoader().getResourceAsStream(
  +                    ruleResource);
               if (is != null) {
                   loadRulesFromStream(is, digester, pattern);
                   return;
  @@ -330,8 +327,8 @@
           }
   
           // load via method on explicit Rule Class        
  -        if (ruleClass_ != null) {
  -            loadRulesFromClass(ruleClass_, digester, pattern);
  +        if (ruleClass != null) {
  +            loadRulesFromClass(ruleClass, digester, pattern);
               return;
           }
   
  @@ -339,7 +336,7 @@
           {
               Class[] paramSpec = { Digester.class, String.class };
               Method ruleMethod = MethodUtils.getAccessibleMethod(
  -                pluginClass_, ruleMethodName_, paramSpec);
  +                pluginClass, ruleMethodName, paramSpec);
               if (ruleMethod != null) 
               {
                   try {
  @@ -347,8 +344,8 @@
                       Object none = ruleMethod.invoke(null, params);
                   } catch (Exception e) {
                       throw new PluginWrappedException(
  -                        "Unable to configure class [" + pluginClass_ + "]"
  -                        + " using method [" + ruleMethodName_ + "]", e);
  +                        "Unable to configure class [" + pluginClass + "]"
  +                        + " using method [" + ruleMethodName + "]", e);
                   }
                   return;
               }
  @@ -357,15 +354,14 @@
           // look for rule class
           {
               if (debug) {
  -                log.debug("plugin class type:" + pluginClass_.getName());
  +                log.debug("plugin class type:" + pluginClass.getName());
               }
  -            String ruleClassName = pluginClass_.getName() + "RuleInfo";
  +            String ruleClassName = pluginClass.getName() + "RuleInfo";
   
               Class ruleClass;
               try {
                   ruleClass = digester.getClassLoader().loadClass(ruleClassName);
  -            }
  -            catch(ClassNotFoundException cnfe) {
  +            } catch(ClassNotFoundException cnfe) {
                   ruleClass = null;
               }
   
  @@ -378,10 +374,10 @@
           // look for  resource
           {
               String resourceName = 
  -                pluginClass_.getClass().getName().replace('.', '/')
  +                pluginClass.getClass().getName().replace('.', '/')
                   + "RuleInfo.xml";
               InputStream is = 
  -                pluginClass_.getClassLoader().getResourceAsStream(
  +                pluginClass.getClassLoader().getResourceAsStream(
                       resourceName);
               if (is != null) {
                   loadRulesFromStream(is, digester, pattern);
  @@ -390,7 +386,7 @@
           }
           
           // try autoSetProperties
  -        if (autoSetProperties_) {
  +        if (autoSetProperties) {
               if (debug) {
                   log.debug("adding autoset for pattern [" + pattern + "]");
               }
  @@ -401,11 +397,9 @@
       /**
        * Load custom rules from a specified stream of xml data.
        */
  -    private void loadRulesFromStream(
  -    InputStream is, 
  -    Digester digester,
  -    String pattern) 
  -    throws PluginWrappedException {
  +    private void loadRulesFromStream(InputStream is, Digester digester,
  +                                     String pattern) 
  +                                     throws PluginWrappedException {
           try
           {
               throw new PluginAssertionFailure(
  @@ -414,8 +408,7 @@
           finally {
               try {
                   is.close();
  -            }
  -            catch(IOException ioe) {
  +            } catch(IOException ioe) {
                   Log log = digester.getLogger();
                   log.warn("Unable to close stream after reading rules", ioe);
               }
  @@ -425,14 +418,12 @@
       /**
        * Load custom rules from a specified class.
        */
  -    private void loadRulesFromClass(
  -    Class ruleClass, 
  -    Digester digester,
  -    String pattern)
  -    throws PluginWrappedException {
  +    private void loadRulesFromClass(Class ruleClass, Digester digester,
  +                                    String pattern)
  +                                    throws PluginWrappedException {
           Class[] paramSpec = { Digester.class, String.class };
           Method ruleMethod = MethodUtils.getAccessibleMethod(
  -            ruleClass, ruleMethodName_, paramSpec);
  +            ruleClass, ruleMethodName, paramSpec);
           if (ruleMethod == null) {
               throw new PluginWrappedException(
                   "rule class specified, but rules method not found on it.");
  @@ -442,9 +433,9 @@
               Object none = ruleMethod.invoke(null, params);
           } catch (Exception e) {
               throw new PluginWrappedException(
  -                "Unable to configure class [" + pluginClass_ + "]"
  -                + " using rule class [" + ruleClass_ + "]"
  -                + " method [" + ruleMethodName_ + "]", e);
  +                "Unable to configure class [" + pluginClass + "]"
  +                + " using rule class [" + ruleClass + "]"
  +                + " method [" + ruleMethodName + "]", e);
           } 
       }
       
  @@ -457,13 +448,13 @@
        * @return true if the specified object has the same options as this one.
        */
       public boolean isEquivalent(Declaration d) {
  -        if (different(id_, d.id_)) return false;
  -        if (pluginClass_ != d.pluginClass_) return false;
  -        if (different(ruleMethodName_, d.ruleMethodName_)) return false;
  -        if (ruleClass_ != d.ruleClass_) return false;
  -        if (different(ruleResource_, d.ruleResource_)) return false;
  -        if (different(ruleFile_, d.ruleFile_)) return false;
  -        if (autoSetProperties_ != d.autoSetProperties_) return false;
  +        if (different(id, d.id)) return false;
  +        if (pluginClass != d.pluginClass) return false;
  +        if (different(ruleMethodName, d.ruleMethodName)) return false;
  +        if (ruleClass != d.ruleClass) return false;
  +        if (different(ruleResource, d.ruleResource)) return false;
  +        if (different(ruleFile, d.ruleFile)) return false;
  +        if (autoSetProperties != d.autoSetProperties) return false;
   
           // all significant fields match; these declarations are identical.
           return true;
  
  
  
  1.4       +7 -6      jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/InitializableRule.java
  
  Index: InitializableRule.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/InitializableRule.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InitializableRule.java	9 Oct 2003 21:09:48 -0000	1.3
  +++ InitializableRule.java	16 Nov 2003 22:37:35 -0000	1.4
  @@ -78,9 +78,10 @@
        * 
        * @param pattern is the digester match pattern that will trigger this
        *        rule.
  -     * @exception PluginConfigurationException is thrown if the InitializableRule determines that
  -     *            it cannot correctly initialise itself for any reason.
  +     * @exception
  +     *  PluginConfigurationException is thrown if the InitializableRule 
  +     *  determines that it cannot correctly initialise itself for any reason.
        */
       public void postRegisterInit(String pattern)
  -    throws PluginConfigurationException;
  +                                 throws PluginConfigurationException;
   }
  
  
  
  1.8       +105 -109  jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginCreateRule.java
  
  Index: PluginCreateRule.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginCreateRule.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PluginCreateRule.java	12 Nov 2003 23:21:18 -0000	1.7
  +++ PluginCreateRule.java	16 Nov 2003 22:37:35 -0000	1.8
  @@ -91,36 +91,36 @@
       public static final String GLOBAL_PLUGIN_ID_ATTR = "plugin-id";
       
       // see setGlobalPluginClassAttribute
  -    private static String globalPluginClassAttrNs_ = GLOBAL_PLUGIN_CLASS_ATTR_NS;
  -    private static String globalPluginClassAttr_ = GLOBAL_PLUGIN_CLASS_ATTR;
  +    private static String globalPluginClassAttrNs = GLOBAL_PLUGIN_CLASS_ATTR_NS;
  +    private static String globalPluginClassAttr = GLOBAL_PLUGIN_CLASS_ATTR;
   
       // see setGlobalPluginIdAttribute
  -    private static String globalPluginIdAttrNs_ = GLOBAL_PLUGIN_ID_ATTR_NS;
  -    private static String globalPluginIdAttr_ = GLOBAL_PLUGIN_ID_ATTR;
  +    private static String globalPluginIdAttrNs = GLOBAL_PLUGIN_ID_ATTR_NS;
  +    private static String globalPluginIdAttr = GLOBAL_PLUGIN_ID_ATTR;
       
       // see setPluginClassAttribute
  -    private String pluginClassAttrNs_ = globalPluginClassAttrNs_;
  -    private String pluginClassAttr_ = globalPluginClassAttr_;
  +    private String pluginClassAttrNs = globalPluginClassAttrNs;
  +    private String pluginClassAttr = globalPluginClassAttr;
       
       // see setPluginIdAttribute
  -    private String pluginIdAttrNs_ = globalPluginIdAttrNs_;
  -    private String pluginIdAttr_ = globalPluginIdAttr_;
  +    private String pluginIdAttrNs = globalPluginIdAttrNs;
  +    private String pluginIdAttr = globalPluginIdAttr;
       
       /**
        * In order to invoke the addRules method on the plugin class correctly,
        * we need to know the pattern which this rule is matched by.
        */
  -    private String pattern_;
  +    private String pattern;
   
       /** A base class that any plugin must derive from. */
  -    private Class baseClass_ = null;
  +    private Class baseClass = null;
   
       /**
        * Info about optional default plugin to be used if no plugin-id is
        * specified in the input data. This can simplify the syntax where one
        * particular plugin is usually used.
        */
  -    private Declaration defaultPlugin_;
  +    private Declaration defaultPlugin;
   
       /**
        * Currently, none of the Rules methods allow exceptions to be thrown.
  @@ -128,14 +128,14 @@
        * cause the digester to stop. Instead, we cache the exception and throw
        * it the first time the begin() method is called.
        */
  -    private PluginConfigurationException initException_;
  +    private PluginConfigurationException initException;
   
       /**
        * Our private set of rules associated with the concrete class that
        * the user requested to be instantiated. This object is only valid
        * between a call to begin() and the corresponding call to end().
        */
  -    private PluginRules localRules_; 
  +    private PluginRules localRules; 
       
       //-------------------- static methods -----------------------------------
       
  @@ -167,10 +167,10 @@
        * @param attrName is the attribute whose value contains the name of the
        * class to be instantiated.
        */
  -    public static void setGlobalPluginClassAttribute(
  -    String namespaceUri, String attrName) {
  -        globalPluginClassAttrNs_ = namespaceUri;
  -        globalPluginClassAttr_ = attrName;
  +    public static void setGlobalPluginClassAttribute(String namespaceUri, 
  +                                                     String attrName) {
  +        globalPluginClassAttrNs = namespaceUri;
  +        globalPluginClassAttr = attrName;
       }
   
       /**
  @@ -201,10 +201,10 @@
        * @param attrName is the attribute whose value contains the id of the
        * plugin declaration to be used when instantiating an object.
        */
  -    public static void setGlobalPluginIdAttribute(
  -    String namespaceUri, String attrName) {
  -        globalPluginIdAttrNs_ = namespaceUri;
  -        globalPluginIdAttr_ = attrName;
  +    public static void setGlobalPluginIdAttribute(String namespaceUri, 
  +                                                  String attrName) {
  +        globalPluginIdAttrNs = namespaceUri;
  +        globalPluginIdAttr = attrName;
       }
   
       //-------------------- constructors -------------------------------------
  @@ -218,7 +218,7 @@
        */
       public PluginCreateRule(Class baseClass) {
           super();
  -        baseClass_ = baseClass;
  +        this.baseClass = baseClass;
       }
   
       /**
  @@ -234,41 +234,41 @@
        */
       public PluginCreateRule(Class baseClass, Class dfltPluginClass) {
           super();
  -        baseClass_ = baseClass;
  +        this.baseClass = baseClass;
           if (dfltPluginClass != null) {
  -            defaultPlugin_ = new Declaration(dfltPluginClass);
  +            defaultPlugin = new Declaration(dfltPluginClass);
           }
       }
   
       //------------------- properties ---------------------------------------
   
       public void setDefaultRuleMethod(String dfltPluginRuleMethod) {
  -        if (defaultPlugin_ != null) {
  -            defaultPlugin_.setRuleMethod(dfltPluginRuleMethod);
  +        if (defaultPlugin != null) {
  +            defaultPlugin.setRuleMethod(dfltPluginRuleMethod);
           }
       }
       
       public void setDefaultRuleClass(Class dfltPluginRuleClass) {
  -        if (defaultPlugin_ != null) {
  -            defaultPlugin_.setRuleClass(dfltPluginRuleClass);
  +        if (defaultPlugin != null) {
  +            defaultPlugin.setRuleClass(dfltPluginRuleClass);
           }
       }
       
       public void setDefaultRuleResource(String dfltPluginRuleResource) {
  -        if (defaultPlugin_ != null) {
  -            defaultPlugin_.setRuleResource(dfltPluginRuleResource);
  +        if (defaultPlugin != null) {
  +            defaultPlugin.setRuleResource(dfltPluginRuleResource);
           }
       }
       
       public void setDefaultRuleFile(String dfltPluginRuleFile) {
  -        if (defaultPlugin_ != null) {
  -            defaultPlugin_.setRuleFile(new File(dfltPluginRuleFile));
  +        if (defaultPlugin != null) {
  +            defaultPlugin.setRuleFile(new File(dfltPluginRuleFile));
           }
       }
   
       public void setDefaultRuleAutoSetProperties(boolean enabled) {
  -        if (defaultPlugin_ != null) {
  -            defaultPlugin_.setAutoSetProperties(enabled);
  +        if (defaultPlugin != null) {
  +            defaultPlugin.setAutoSetProperties(enabled);
           }
       }
       
  @@ -278,10 +278,9 @@
        * <p>
        * See setGlobalPluginClassAttribute for more info.
        */
  -    public void setPluginClassAttribute(
  -    String namespaceUri, String attrName) {
  -        pluginClassAttrNs_ = namespaceUri;
  -        pluginClassAttr_ = attrName;
  +    public void setPluginClassAttribute(String namespaceUri, String attrName) {
  +        pluginClassAttrNs = namespaceUri;
  +        pluginClassAttr = attrName;
       }
   
       /**
  @@ -290,10 +289,9 @@
        * <p>
        * See setGlobalPluginIdAttribute for more info.
        */
  -    public void setPluginIdAttribute(
  -    String namespaceUri, String attrName) {
  -        pluginIdAttrNs_ = namespaceUri;
  -        pluginIdAttr_ = attrName;
  +    public void setPluginIdAttribute(String namespaceUri, String attrName) {
  +        pluginIdAttrNs = namespaceUri;
  +        pluginIdAttr = attrName;
       }
   
       //------------------- methods --------------------------------------------
  @@ -307,8 +305,8 @@
        * this rule instance, eg "root/widget".
        * @exception PluginConfigurationException
        */
  -    public void postRegisterInit(String pattern)
  -    throws PluginConfigurationException {
  +    public void postRegisterInit(String matchPattern)
  +                                 throws PluginConfigurationException {
           Log log = LogUtils.getLogger(digester);
           boolean debug = log.isDebugEnabled();
           if (debug) {
  @@ -321,13 +319,13 @@
               // Note that this means that PluginCreateRule cannot be added
               // to a Rules object which has not yet been added to a
               // Digester object.
  -            initException_ = new PluginConfigurationException(
  +            initException = new PluginConfigurationException(
                    "Invalid invocation of postRegisterInit" + 
                    ": digester not set.");
  -            throw initException_;
  +            throw initException;
           }
   
  -        if (pattern_ != null) {
  +        if (pattern != null) {
               // We have been called twice, ie a single instance has been
               // associated with multiple patterns.
               //
  @@ -335,13 +333,13 @@
               // multiple patterns. However for plugins, this creates some 
               // complications. Some day this may be supported; however for 
               // now we just reject this situation.
  -            initException_ = new PluginConfigurationException(
  +            initException = new PluginConfigurationException(
                  "A single PluginCreateRule instance has been mapped to" + 
                    " multiple patterns; this is not supported.");
  -            throw initException_;
  +            throw initException;
           }
   
  -        if (pattern.indexOf('*') != -1) {
  +        if (matchPattern.indexOf('*') != -1) {
               // having wildcards in patterns is extremely difficult to
               // deal with. For now, we refuse to allow this.
               //
  @@ -353,31 +351,31 @@
               // (b) determining whether one pattern is "below" another,
               //     as done by PluginRules. Without wildcards, "below"
               //     just means startsWith, which is easy to check.
  -            initException_ = new PluginConfigurationException(
  +            initException = new PluginConfigurationException(
                    "A PluginCreateRule instance has been mapped to" + 
  -                 " pattern [" + pattern + "]." + 
  +                 " pattern [" + matchPattern + "]." + 
                    " This pattern includes a wildcard character." + 
                    " This is not supported by the plugin architecture.");
  -            throw initException_;
  +            throw initException;
           }
   
  -        if (baseClass_ == null) {
  -            baseClass_ = Object.class;
  +        if (baseClass == null) {
  +            baseClass = Object.class;
           }
           
           // check default class is valid
  -        if (defaultPlugin_ != null) {
  -            if (!baseClass_.isAssignableFrom(defaultPlugin_.getPluginClass())) {
  -                initException_ = new PluginConfigurationException(
  +        if (defaultPlugin != null) {
  +            if (!baseClass.isAssignableFrom(defaultPlugin.getPluginClass())) {
  +                initException = new PluginConfigurationException(
                        "Default class [" + 
  -                     defaultPlugin_.getPluginClass().getName() + 
  +                     defaultPlugin.getPluginClass().getName() + 
                        "] does not inherit from [" + 
  -                     baseClass_.getName() + "].");
  -                throw initException_;
  +                     baseClass.getName() + "].");
  +                throw initException;
               }
   
               try {
  -                defaultPlugin_.init(digester);
  +                defaultPlugin.init(digester);
                   
               } catch(PluginWrappedException pwe) {
               
  @@ -387,7 +385,7 @@
           }
   
           // remember the pattern for later
  -        pattern_ = pattern;
  +        pattern = matchPattern;
       }
   
       /**
  @@ -415,45 +413,44 @@
        * @throws PluginInvalidInputException
        * @throws PluginConfigurationException
        */
  -    public void begin(
  -    String namespace, String name, 
  -    org.xml.sax.Attributes attributes)
  -    throws java.lang.Exception {
  +    public void begin(String namespace, String name,
  +                      org.xml.sax.Attributes attributes)
  +                      throws java.lang.Exception {
           Log log = digester.getLogger();
           boolean debug = log.isDebugEnabled();
           if (debug) {
  -            log.debug("PluginCreateRule.begin" + ": pattern=[" + pattern_ + "]" + 
  +            log.debug("PluginCreateRule.begin" + ": pattern=[" + pattern + "]" + 
                     " match=[" + digester.getMatch() + "]");
           }
   
  -        if (initException_ != null) {
  +        if (initException != null) {
               // we had a problem during initialisation that we could
               // not report then; report it now.
  -            throw initException_;
  +            throw initException;
           }
           
           String currMatch = digester.getMatch();
  -        if (currMatch.length() == pattern_.length()) {
  +        if (currMatch.length() == pattern.length()) {
               // ok here we are actually instantiating a new plugin object,
               // and storing its rules into a new Rules object
  -            if (localRules_ != null) {
  +            if (localRules != null) {
                   throw new PluginAssertionFailure(
  -                    "Begin called when localRules_ is not null.");
  +                    "Begin called when localRules is not null.");
               }
                         
               PluginRules oldRules = (PluginRules) digester.getRules();
  -            localRules_ = new PluginRules(this, oldRules);
  -            PluginManager pluginManager = localRules_.getPluginManager();
  +            localRules = new PluginRules(this, oldRules);
  +            PluginManager pluginManager = localRules.getPluginManager();
               Declaration currDeclaration = null;
               
               if (debug) {
                   log.debug("PluginCreateRule.begin: installing new plugin: " 
                       + "oldrules=" + oldRules.toString()
  -                    + ", localrules=" + localRules_.toString());
  +                    + ", localrules=" + localRules.toString());
               }
                 
               String pluginClassName; 
  -            if (pluginClassAttrNs_ == null) {
  +            if (pluginClassAttrNs == null) {
                   // Yep, this is ugly.
                   //
                   // In a namespace-aware parser, the one-param version will 
  @@ -461,19 +458,19 @@
                   //
                   // In a non-namespace-aware parser, the two-param version will 
                   // never return any attributes, ever.
  -                pluginClassName = attributes.getValue(pluginClassAttr_);
  +                pluginClassName = attributes.getValue(pluginClassAttr);
               } else {
                   pluginClassName = 
  -                    attributes.getValue(pluginClassAttrNs_, pluginClassAttr_);
  +                    attributes.getValue(pluginClassAttrNs, pluginClassAttr);
               }
   
               String pluginId; 
  -            if (pluginIdAttrNs_ == null) {
  -                pluginId = attributes.getValue(pluginIdAttr_);
  +            if (pluginIdAttrNs == null) {
  +                pluginId = attributes.getValue(pluginIdAttr);
               }
               else {
                   pluginId = 
  -                    attributes.getValue(pluginIdAttrNs_, pluginIdAttr_);
  +                    attributes.getValue(pluginIdAttrNs, pluginIdAttr);
               }
               
               if (pluginClassName != null) {
  @@ -497,19 +494,19 @@
                       throw new PluginInvalidInputException(
                           "Plugin id [" + pluginId + "] is not defined.");
                   }
  -            } else if (defaultPlugin_ != null) {
  -                currDeclaration = defaultPlugin_;
  +            } else if (defaultPlugin != null) {
  +                currDeclaration = defaultPlugin;
               }
               else {
                   throw new PluginInvalidInputException(
                       "No plugin class specified for element "
  -                    + pattern_);
  +                    + pattern);
               }
               
               // now load up the custom rules into a private Rules instance
  -            digester.setRules(localRules_);
  +            digester.setRules(localRules);
           
  -            currDeclaration.configure(digester, pattern_);
  +            currDeclaration.configure(digester, pattern);
       
               Class pluginClass = currDeclaration.getPluginClass();
               
  @@ -517,7 +514,7 @@
               getDigester().push(instance);
               if (debug) {
                   log.debug(
  -                    "PluginCreateRule.begin" + ": pattern=[" + pattern_ + "]" + 
  +                    "PluginCreateRule.begin" + ": pattern=[" + pattern + "]" + 
                       " match=[" + digester.getMatch() + "]" + 
                       " pushed instance of plugin [" + pluginClass.getName() + "]");
               }
  @@ -533,11 +530,11 @@
           if (debug) {
               log.debug("PluginCreateRule.begin: firing nested rules: " 
                   + "oldrules=" + oldRules.toString()
  -                + ", localrules=" + localRules_.toString());
  +                + ", localrules=" + localRules.toString());
           }
   
  -        // assert oldRules = localRules_.oldRules
  -        digester.setRules(localRules_);
  +        // assert oldRules = localRules.oldRules
  +        digester.setRules(localRules);
           delegateBegin(namespace, name, attributes);
           digester.setRules(oldRules);
   
  @@ -554,11 +551,11 @@
        * @see #begin
        */
       public void body(String namespace, String name, String text)
  -        throws Exception {
  +                     throws Exception {
               
           Rules oldRules = digester.getRules();
  -        // assert oldRules == localRules_.oldRules
  -        digester.setRules(localRules_);
  +        // assert oldRules == localRules.oldRules
  +        digester.setRules(localRules);
           delegateBody(namespace, name, text);
           digester.setRules(oldRules);
       }
  @@ -585,19 +582,19 @@
        * @see #begin
        */
       public void end(String namespace, String name)
  -             throws Exception {
  +                    throws Exception {
               
           Rules oldRules = digester.getRules();
  -        // assert oldRules == localRules_.parentRules
  -        digester.setRules(localRules_);
  +        // assert oldRules == localRules.parentRules
  +        digester.setRules(localRules);
           delegateEnd(namespace, name);
           digester.setRules(oldRules);
   
           String currMatch = digester.getMatch();
  -        if (currMatch.length() == pattern_.length()) {
  +        if (currMatch.length() == pattern.length()) {
               // the end of the element on which the PluginCreateRule has
               // been mounted has been reached.
  -            localRules_ = null;
  +            localRules = null;
               ((PluginRules) oldRules).endPlugin(this);
               digester.pop();
           }
  @@ -616,7 +613,7 @@
        * @return The pattern value
        */
       public String getPattern() {
  -        return pattern_;
  +        return pattern;
       }
       
       /**
  @@ -624,10 +621,9 @@
        * in our private rules object, then executing the begin method of
        * each matching rule.
        */
  -    public void delegateBegin(
  -    String namespace, String name, 
  -    org.xml.sax.Attributes attributes)
  -    throws java.lang.Exception {
  +    public void delegateBegin(String namespace, String name, 
  +                              org.xml.sax.Attributes attributes)
  +                              throws java.lang.Exception {
           
           // Fire "begin" events for all relevant rules
           Log log = digester.getLogger();
  @@ -648,7 +644,7 @@
        * Here we act like Digester.body, except against our private rules.
        */
       public void delegateBody(String namespace, String name, String text)
  -    throws Exception {
  +                             throws Exception {
           // Fire "body" events for all relevant rules
           Log log = digester.getLogger();
           boolean debug = log.isDebugEnabled();
  @@ -668,7 +664,7 @@
        * Here we act like Digester.end.
        */
       public void delegateEnd(String namespace, String name)
  -    throws Exception {
  +                            throws Exception {
           // Fire "end" events for all relevant rules in reverse order
           Log log = digester.getLogger();
           boolean debug = log.isDebugEnabled();
  
  
  
  1.6       +7 -10     jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginDeclarationRule.java
  
  Index: PluginDeclarationRule.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginDeclarationRule.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PluginDeclarationRule.java	28 Oct 2003 23:31:08 -0000	1.5
  +++ PluginDeclarationRule.java	16 Nov 2003 22:37:35 -0000	1.6
  @@ -107,11 +107,9 @@
        *@exception java.lang.Exception
        */
   
  -    public void begin(
  -            String namespace,
  -            String name,
  -            org.xml.sax.Attributes attributes)
  -             throws java.lang.Exception {
  +    public void begin(String namespace, String name,
  +                      org.xml.sax.Attributes attributes)
  +                      throws java.lang.Exception {
                    
           Log log = digester.getLogger();
           boolean debug = log.isDebugEnabled();
  @@ -152,8 +150,7 @@
               Class ruleClass;
               try {
                   ruleClass = digester.getClassLoader().loadClass(ruleClassName);
  -            }
  -            catch(ClassNotFoundException cnfe) {
  +            } catch(ClassNotFoundException cnfe) {
                   throw new ClassNotFoundException(
                       "Rule class [" + ruleClassName + "] not found.");
               }
  
  
  
  1.5       +15 -15    jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginManager.java
  
  Index: PluginManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PluginManager.java	28 Oct 2003 23:31:08 -0000	1.4
  +++ PluginManager.java	16 Nov 2003 22:37:35 -0000	1.5
  @@ -80,13 +80,13 @@
   public class PluginManager {
   
       /** Map of classname->Declaration */
  -    private HashMap declarationsByClass_ = new HashMap();
  +    private HashMap declarationsByClass = new HashMap();
   
       /** Map of id->Declaration  */
  -    private HashMap declarationsById_ = new HashMap();
  +    private HashMap declarationsById = new HashMap();
   
       /** the parent manager to which this one may delegate lookups. */
  -    private PluginManager parent_;
  +    private PluginManager parent;
   
       //------------------- constructors ---------------------------------------
       
  @@ -96,7 +96,7 @@
   
       /** Constructor. */
       public PluginManager(PluginManager parent) {
  -        parent_ = parent;
  +        this.parent = parent;
       }
       
       //------------------- methods --------------------------------------------
  @@ -117,10 +117,10 @@
           Class pluginClass = decl.getPluginClass();
           String id = decl.getId();
           
  -        declarationsByClass_.put(pluginClass.getName(), decl);
  +        declarationsByClass.put(pluginClass.getName(), decl);
               
           if (id != null) {
  -            declarationsById_.put(id, decl);
  +            declarationsById.put(id, decl);
               if (debug) {
                   log.debug(
                       "Indexing plugin-id [" + id + "]"
  @@ -135,10 +135,10 @@
        */
       public Declaration getDeclarationByClass(String className) {
           Declaration decl = 
  -            (Declaration) declarationsByClass_.get(className);
  +            (Declaration) declarationsByClass.get(className);
               
  -        if ((decl == null) && (parent_ != null)) {
  -            decl = parent_.getDeclarationByClass(className);
  +        if ((decl == null) && (parent != null)) {
  +            decl = parent.getDeclarationByClass(className);
           }
   
           return decl;
  @@ -152,10 +152,10 @@
        *@return The declaration value
        */
       public Declaration getDeclarationById(String id) {
  -        Declaration decl = (Declaration) declarationsById_.get(id);
  +        Declaration decl = (Declaration) declarationsById.get(id);
   
  -        if ((decl == null) && (parent_ != null)) {
  -            decl = parent_.getDeclarationById(id);
  +        if ((decl == null) && (parent != null)) {
  +            decl = parent.getDeclarationById(id);
           }
   
           return decl;
  
  
  
  1.6       +43 -43    jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginRules.java
  
  Index: PluginRules.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginRules.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PluginRules.java	2 Nov 2003 23:26:59 -0000	1.5
  +++ PluginRules.java	16 Nov 2003 22:37:35 -0000	1.6
  @@ -89,12 +89,12 @@
        * The rules implementation that we are "enhancing" with plugins
        * functionality, as per the Decorator pattern.
        */
  -    private Rules decoratedRules_;
  +    private Rules decoratedRules;
   
       /**
        * The Digester instance with which this Rules instance is associated.
        */
  -    protected Digester digester_ = null;
  +    protected Digester digester = null;
   
       /**
        * The currently active PluginCreateRule. When the begin method of a
  @@ -102,13 +102,13 @@
        * encountered, this is cleared. Any attempt to call match() while this
        * attribute is set just causes this single rule to be returned.
        */
  -    private PluginCreateRule currPluginCreateRule_ = null;
  +    private PluginCreateRule currPluginCreateRule = null;
       
       /** Object which contains information about all known plugins. */
  -    private PluginManager pluginManager_;
  +    private PluginManager pluginManager;
   
       /** The parent rules object for this object. */
  -    private Rules parent_;
  +    private Rules parent;
       
       // ------------------------------------------------------------- Constructor
       
  @@ -118,8 +118,8 @@
        * object before parsing starts.
        */
       public PluginRules() {
  -        decoratedRules_ = new RulesBase();
  -        pluginManager_ = new PluginManager();
  +        decoratedRules = new RulesBase();
  +        pluginManager = new PluginManager();
       }
   
       /**
  @@ -127,8 +127,8 @@
        * using the specified implementation.
        */
       public PluginRules(Rules decoratedRules) {
  -        decoratedRules_ = decoratedRules;
  -        pluginManager_ = new PluginManager();
  +        this.decoratedRules = decoratedRules;
  +        pluginManager = new PluginManager();
       }
   
       /**
  @@ -146,9 +146,9 @@
        * "inherit" declarations from further up the tree.
        */
        PluginRules(PluginCreateRule pcr, PluginRules parent) {
  -        decoratedRules_ = new RulesBase();
  -        parent_ = parent;
  -        pluginManager_ = new PluginManager(parent.pluginManager_);
  +        decoratedRules = new RulesBase();
  +        this.parent = parent;
  +        pluginManager = new PluginManager(parent.pluginManager);
       }
       
       // ------------------------------------------------------------- Properties
  @@ -157,14 +157,14 @@
        * Return the parent Rules object.
        */
       public Rules getParent() {
  -        return parent_;
  +        return parent;
       }
       
       /**
        * Return the Digester instance with which this instance is associated.
        */
       public Digester getDigester() {
  -        return (digester_);
  +        return digester;
       }
   
       /**
  @@ -173,8 +173,8 @@
        * @param digester The newly associated Digester instance
        */
       public void setDigester(Digester digester) {
  -        digester_ = digester;
  -        decoratedRules_.setDigester(digester);
  +        this.digester = digester;
  +        decoratedRules.setDigester(digester);
       }
   
       /**
  @@ -182,7 +182,7 @@
        * added <code>Rule</code> objects.
        */
       public String getNamespaceURI() {
  -        return decoratedRules_.getNamespaceURI();
  +        return decoratedRules.getNamespaceURI();
       }
   
       /**
  @@ -194,7 +194,7 @@
        *  regardless of the current namespace URI
        */
       public void setNamespaceURI(String namespaceURI) {
  -        decoratedRules_.setNamespaceURI(namespaceURI);
  +        decoratedRules.setNamespaceURI(namespaceURI);
       }
   
       /**
  @@ -203,7 +203,7 @@
        * @return The pluginManager value
        */
       public PluginManager getPluginManager() {
  -        return pluginManager_;
  +        return pluginManager;
       }
   
       // --------------------------------------------------------- Public Methods
  @@ -218,7 +218,7 @@
        * @return list of all Rule objects known to this Rules instance.
        */
       public List rules() {
  -        return decoratedRules_.rules();
  +        return decoratedRules.rules();
       }
   
       /**
  @@ -228,7 +228,7 @@
        * @param rule Rule instance to be registered
        */
       public void add(String pattern, Rule rule) {
  -        Log log = LogUtils.getLogger(digester_);
  +        Log log = LogUtils.getLogger(digester);
           boolean debug = log.isDebugEnabled();
           
           if (debug) {
  @@ -236,7 +236,7 @@
                     " to rule of type [" + rule.getClass().getName() + "]");
           }
           
  -        decoratedRules_.add(pattern, rule);
  +        decoratedRules.add(pattern, rule);
   
           if (rule instanceof InitializableRule) {
               try {
  @@ -265,7 +265,7 @@
        * Clear all rules.
        */
       public void clear() {
  -        decoratedRules_.clear();
  +        decoratedRules.clear();
       }
       
       /**
  @@ -291,7 +291,7 @@
        * method.
        * <p>
        * If we have encountered the start of a PluginCreateRule and have not
  -     * yet encountered the end tag, then the currPluginCreateRule_ attribute
  +     * yet encountered the end tag, then the currPluginCreateRule attribute
        * will be non-null. In this case, we just return this rule object as the
        * sole match. The calling Digester will then invoke the begin/body/end
        * methods on this rule, which are responsible for invoking all rules
  @@ -302,7 +302,7 @@
        * @param pattern Nesting pattern to be matched
        */
       public List match(String namespaceURI, String pattern) {
  -        Log log = LogUtils.getLogger(digester_);
  +        Log log = LogUtils.getLogger(digester);
           boolean debug = log.isDebugEnabled();
           
           if (debug) {
  @@ -312,19 +312,19 @@
           }
   
           List matches;
  -        if ((currPluginCreateRule_ != null) && 
  -            (pattern.length() > currPluginCreateRule_.getPattern().length())) {
  +        if ((currPluginCreateRule != null) && 
  +            (pattern.length() > currPluginCreateRule.getPattern().length())) {
               // assert pattern.startsWith(currPluginCreateRule.getPattern())
               if (debug) {
                   log.debug(
                       "Pattern [" + pattern + "] matching PluginCreateRule " 
  -                    + currPluginCreateRule_.toString());
  +                    + currPluginCreateRule.toString());
               }
               matches = new ArrayList(1);
  -            matches.add(currPluginCreateRule_);
  +            matches.add(currPluginCreateRule);
           }
           else {
  -            matches = decoratedRules_.match(namespaceURI, pattern); 
  +            matches = decoratedRules.match(namespaceURI, pattern); 
           }
   
           return matches;
  @@ -340,12 +340,12 @@
        * endPlugin method is called.
        */
       public void beginPlugin(PluginCreateRule pcr) {
  -        Log log = LogUtils.getLogger(digester_);
  +        Log log = LogUtils.getLogger(digester);
           boolean debug = log.isDebugEnabled();
   
  -        if (currPluginCreateRule_ != null) {
  +        if (currPluginCreateRule != null) {
               throw new PluginAssertionFailure(
  -                "endPlugin called when currPluginCreateRule_ is not null.");
  +                "endPlugin called when currPluginCreateRule is not null.");
           }
   
           if (debug) {
  @@ -354,7 +354,7 @@
                   + " on rules object " + this.toString());
           }
   
  -        currPluginCreateRule_ = pcr;
  +        currPluginCreateRule = pcr;
       }
       
       /**
  @@ -362,20 +362,20 @@
        * See {@link #beginPlugin}.
        */
       public void endPlugin(PluginCreateRule pcr) {
  -        Log log = LogUtils.getLogger(digester_);
  +        Log log = LogUtils.getLogger(digester);
           boolean debug = log.isDebugEnabled();
   
  -        if (currPluginCreateRule_ == null) {
  +        if (currPluginCreateRule == null) {
               throw new PluginAssertionFailure(
  -                "endPlugin called when currPluginCreateRule_ is null.");
  +                "endPlugin called when currPluginCreateRule is null.");
           }
           
  -        if (currPluginCreateRule_ != pcr) {
  +        if (currPluginCreateRule != pcr) {
               throw new PluginAssertionFailure(
  -                "endPlugin called with unexpected PluginCreateRule_.");
  +                "endPlugin called with unexpected PluginCreateRule instance.");
           }
           
  -        currPluginCreateRule_ = null;
  +        currPluginCreateRule = null;
           if (debug) {
               log.debug(
                   "Leaving PluginCreateRule " + pcr.toString()
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org