incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Incubator Wiki] Update of "Synapse/InProgress/RegistryAccessThoughts" by PaulFremantle
Date Fri, 30 Jun 2006 13:25:44 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Incubator Wiki" for change notification.

The following page has been changed by PaulFremantle:
http://wiki.apache.org/incubator/Synapse/InProgress/RegistryAccessThoughts

------------------------------------------------------------------------------
  Note that the particular approach of '''<property name="" key=""/>''' is really just
an aliasing mechanism.
  
  If you specify a key then it will lookup the entry *whenever* you use it. Of course we will
optimize cache etc this. But the semantic is dynamic.
- We implement this by making getProperty clever:
+ 
+ We also want to be efficient at converting these XMLs into config objects. For example,
Spring configs need to be built into application contexts, XSLTs compiled, etc.
+ 
+ So we will maintain a list of "converters" which can convert from the XML to an object.
If a given converter is registered, then we always run it on the XML before returning the
property. So here is the pseudo-code for getProperty
+ 
  {{{
- // pseudo code.... this ignores some issues!
+ public class DynamicProperty {
+    Mapper xmlMapper;
+    Object cache;
+    long timeCached;
+    String key;
+ }
+     
+    
+ 
  SynapseEnvironment.getProperty(String key) {
      Object obj = hashtable.lookup(key);
-     if (obj instanceof o.a.s.DynamicProperty) {
+     if (obj instanceof DynamicProperty) {
-          XMLRegistry r = this.getRegistry;
+          XMLRegistry r = this.getRegistry;      
+          DynamicProperty dp = (DynamicProperty)obj;
+          //have we ever cached this?
+          if (dp.cache==null) {
+              OMElement el = r.lookup(dp.key);
+              Object fresh = null;
+              if (dp.xmlMapper==null) fresh = el;
+              else fresh = dp.xmlMapper.fromOM(el);
+              dp.cache = fresh;
+              return fresh;
+          }
+          // now check if it is up to date      
+          OMElement el = r.lookupIfModified(dp.key, timeCached);
+ 
+          if (el == null) { // still good - return cached
+              return dp.cache 
+          };
+ 
+          if (dp.xmlMapper==null) fresh = el;
+          else fresh = dp.xmlMapper.fromOM(el);
+          
+          
+          dp.cache = fresh;
+          return fresh;
+ 
+          
+          if (r.isModified, 
+          Object cached = cache.lookup(key);
+          if (cached==null) { // first time reading this
+ 
           Object obj = r.lookup(key); // actually would use a cache but ignore that
      }
      return obj;

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


Mime
View raw message