stephenh    2002/07/24 23:12:30

  Modified:    src/java/org/apache/torque/task TorqueDataModelTask.java
  Log:
  Updated setContextProperties to map all of the torque.xxx properties back to just 
xxx for the templates to use the shorter, non-"torque."-prepended form.
  
  Revision  Changes    Path
  1.17      +31 -0     
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataModelTask.java
  
  Index: TorqueDataModelTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataModelTask.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- TorqueDataModelTask.java  20 Jun 2002 23:55:14 -0000      1.16
  +++ TorqueDataModelTask.java  25 Jul 2002 06:12:30 -0000      1.17
  @@ -365,6 +365,37 @@
   
           return context;
       }
  +    
  +    /**
  +     * Override Texen's behavior in that we'll map any 
  +     * torque.xxx properties to just xxx so that the templates
  +     * don't get over-whelmed with always doing torque.xxx.
  +     * 
  +     * @param file the file to load the context properties from
  +     */
  +    public void setContextProperties( String file )
  +    {
  +        super.setContextProperties(file);
  +        
  +        // Save the keys during iteration to avoid a ConcurrentModificationException
  +        List keys = new ArrayList();
  +        for (Iterator i = contextProperties.getKeys(); i.hasNext(); )
  +        {
  +            String key = (String) i.next();
  +            if (key.startsWith("torque."))
  +            {
  +                keys.add(key);
  +            }
  +        }
  +        
  +        for (Iterator i = keys.iterator(); i.hasNext(); )
  +        {
  +            String key = (String) i.next();
  +            contextProperties.setProperty(
  +                key.substring("torque.".length()),
  +                contextProperties.get(key));
  +        }
  +    }
   
       /**
        * Gets a name to use for the application's data model.
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to