avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From site-...@avalon.apache.org
Subject [Apache Avalon Wiki] Updated: AvalonMusings
Date Sun, 02 May 2004 03:56:59 GMT
   Date: 2004-05-01T20:56:58
   Editor: 203.121.47.163 <>
   Wiki: Apache Avalon Wiki
   Page: AvalonMusings
   URL: http://wiki.apache.org/avalon/AvalonMusings

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -1,4 +1,4 @@
-''(this page is part of the wiki materials for ApacheAvalon; avalon main page in the wiki
is AvalonProjectPages)''
+''(this page is part of the wiki materials for ApacheAvalon; Avalon main page in the wiki
is FrontPage)''
 
 = Object Naming =
 
@@ -22,12 +22,18 @@
 You start the container.  This code runs:
 
 {{{
- class WidgetClass implements Configurable {
-   public void configure(Configuration config) throws ConfigurationException {
+ class WidgetClass implements Configurable 
+ {
+   public void configure(Configuration config) throws ConfigurationException 
+   {
      m_maxSize = config.getInt("mamimumWidgetSize", 5);
+
      m_color = config.getString("color", "red");
+
      // auto-upgrade
-     if (config.getString("oldParamName") != null) config.rename("oldParamName", "newParamName");
+     if (config.getString("oldParamName") != null) 
+       config.rename("oldParamName", "newParamName");
+
      config.saveChanges();
    }
  }
@@ -45,3 +51,8 @@
 }}}
 
 I know, I'm dreaming.  It'd require a special XML parser that didn't muck up the formatting
or remove comments and it would require other weirdness.  On the plus side it would mean that
keeping XML descriptors and actually classes in sync would be easier.  Anyway, just an idle
thought.
+
+Comments from Niclas: 
+  1. XML Parsers doesn't remove comments or any whitespace. The serializers normally do.
+  2. Changing the structure of the configuration (i.e. rename) is IMO BAD! The same code
won't run a second time.
+  3. Is ''Configuration'' related to a setup or is it related to state of a component? If
it is setup, then it should not be changable, and state should be handled outside of Configuration.

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message