hlship      2004/05/19 08:08:50

  Modified:    framework/src/test/hivemind/test/parse PushAttributeRule.sdl
                        TestDescriptorParser.java
               library/src/descriptor/META-INF hivemodule.sdl
               framework/src/test/hivemind/test/ant
                        TestConstructRegistry.java
               framework/src/test/hivemind/test/rules TestSetModule.java
                        WrongType.xml TestPushAttributeRule.java
               framework/src/java/org/apache/hivemind/schema
                        SchemaProcessor.java ElementModel.java
                        AttributeModel.java
               framework/src/java/org/apache/hivemind/schema/rules
                        ReadAttributeRule.java ReadContentRule.java
                        PushAttributeRule.java
               framework/src/test/hivemind/test/config
                        BooleanTranslator.xml ConversionParentMethod.xml
                        ResourceTranslator.xml IntTranslator.xml
                        ObjectTranslator.xml DuplicateAttribute.xml
                        Basics2.xml Basics.xml ExtraAttributeNames.xml
               framework/src/java/org/apache/hivemind/parse
                        DescriptorParser.properties
                        ConversionDescriptor.java
                        AttributeMappingDescriptor.java
                        DescriptorParser.java
               xdocs    sdl.xml case1.xml rules.xml descriptor.xml
               framework/src/java/org/apache/hivemind/schema/impl
                        AttributeModelImpl.java ElementModelImpl.java
               framework/src/java/org/apache/hivemind/impl
                        SchemaProcessorImpl.java SchemaElement.java
                        RegistryImpl.java
               framework/src/descriptor/META-INF hivemodule.sdl
               src/xsl  hivemind.xsl
  Added:       framework/src/test/org/apache/hivemind/impl
                        TestSchemaProcessor.java
  Removed:     framework/src/test/hivemind/test/rules
                        MockSchemaProcessor.java
  Log:
  Move the translator attribute out of <read-attribute> and <read-content> and 
move them up to <attribute> and <element>.
  
  Revision  Changes    Path
  1.2       +2 -2      
jakarta-hivemind/framework/src/test/hivemind/test/parse/PushAttributeRule.sdl
  
  Index: PushAttributeRule.sdl
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/parse/PushAttributeRule.sdl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PushAttributeRule.sdl     19 May 2004 02:30:54 -0000      1.1
  +++ PushAttributeRule.sdl     19 May 2004 15:08:47 -0000      1.2
  @@ -24,7 +24,7 @@
                {
                        rules
                        {
  -                             push-attribute (attribute=foo translator=bar)
  +                             push-attribute (attribute=foo)
                        }
                }
        }
  
  
  
  1.12      +1 -2      
jakarta-hivemind/framework/src/test/hivemind/test/parse/TestDescriptorParser.java
  
  Index: TestDescriptorParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/parse/TestDescriptorParser.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestDescriptorParser.java 19 May 2004 02:30:54 -0000      1.11
  +++ TestDescriptorParser.java 19 May 2004 15:08:47 -0000      1.12
  @@ -433,6 +433,5 @@
                PushAttributeRule rule = (PushAttributeRule)rules.get(0);
        
                assertEquals("foo", rule.getAttributeName());
  -             assertEquals("bar", rule.getTranslator());
        }    
   }
  
  
  
  1.4       +3 -3      
jakarta-hivemind/library/src/descriptor/META-INF/hivemodule.sdl
  
  Index: hivemodule.sdl
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/library/src/descriptor/META-INF/hivemodule.sdl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- hivemodule.sdl    17 May 2004 16:57:46 -0000      1.3
  +++ hivemodule.sdl    19 May 2004 15:08:47 -0000      1.4
  @@ -83,7 +83,7 @@
                                }
                        }
                                
  -                     attribute (name=name-lookup-service-id)
  +                     attribute (name=name-lookup-service-id 
translator=service)
                        {
                                description
                                {
  @@ -97,7 +97,7 @@
                        {
                                map (attribute=jndi-name              
property=jndiName)
                                map (attribute=home-interface         
property=homeInterfaceClassName)
  -                             map (attribute=name-lookup-service-id 
property=nameLookup translator=service)
  +                             map (attribute=name-lookup-service-id 
property=nameLookup)
                        }
                }
        }
  
  
  
  1.8       +16 -5     
jakarta-hivemind/framework/src/test/hivemind/test/ant/TestConstructRegistry.java
  
  Index: TestConstructRegistry.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/ant/TestConstructRegistry.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestConstructRegistry.java        13 May 2004 11:04:41 -0000      1.7
  +++ TestConstructRegistry.java        19 May 2004 15:08:47 -0000      1.8
  @@ -92,6 +92,7 @@
               assertExceptionSubstring(ex, "You must specify a set of module 
descriptors");
           }
   
  +             f.delete();
       }
   
       public void testBasic() throws Exception
  @@ -116,6 +117,8 @@
           cr.execute();
   
           compare(output, 
getFrameworkPath("src/test-data/TestConstructRegistry/testBasic.xml"));
  +        
  +             output.delete();
       }
   
        public void testSDL() throws Exception
  @@ -140,6 +143,8 @@
                cr.execute();
   
                compare(output, 
getFrameworkPath("src/test-data/TestConstructRegistry/testSDL.xml"));
  +
  +             output.delete();
        }
   
       public void testLocalRefs() throws Exception
  @@ -162,6 +167,8 @@
           cr.execute();
   
           compare(output, 
getFrameworkPath("src/test-data/TestConstructRegistry/testLocalRefs.xml"));
  +        
  +             output.delete();
       }
   
       public void testUptoDate() throws Exception
  @@ -184,14 +191,16 @@
           cr.setOutput(output);
   
           cr.execute();
  -
  +        
           compare(output, 
getFrameworkPath("src/test-data/TestConstructRegistry/testUptoDate.xml"));
  -
  -        long stamp = output.lastModified();
  -
  +             
  +             long stamp = output.lastModified();
  +             
           cr.execute();
   
           assertEquals(stamp, output.lastModified());
  +        
  +             output.delete();
       }
   
       public void testJars() throws Exception
  @@ -216,6 +225,8 @@
           cr.execute();
   
           compare(output, 
getFrameworkPath("src/test-data/TestConstructRegistry/testJars.xml"));
  +        
  +             output.delete();
       }
   
       protected void compare(File actual, String expectedPath) throws Exception
  
  
  
  1.5       +19 -5     
jakarta-hivemind/framework/src/test/hivemind/test/rules/TestSetModule.java
  
  Index: TestSetModule.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/rules/TestSetModule.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestSetModule.java        13 May 2004 11:04:47 -0000      1.4
  +++ TestSetModule.java        19 May 2004 15:08:47 -0000      1.5
  @@ -16,8 +16,11 @@
   
   import hivemind.test.FrameworkTestCase;
   
  +import org.apache.hivemind.impl.ModuleImpl;
   import org.apache.hivemind.internal.Module;
  +import org.apache.hivemind.schema.SchemaProcessor;
   import org.apache.hivemind.schema.rules.SetModuleRule;
  +import org.easymock.MockControl;
   
   /**
    * Tests the [EMAIL PROTECTED] 
org.apache.hivemind.schema.rules.SetModuleRule} rule class.
  @@ -45,17 +48,28 @@
   
       public void testSetModuleRule()
       {
  -        MockSchemaProcessor processor = new MockSchemaProcessor();
  +        MockControl control = 
MockControl.createStrictControl(SchemaProcessor.class);
  +        SchemaProcessor p = (SchemaProcessor) control.getMock();
   
  +        Module m = new ModuleImpl();
           Target t = new Target();
   
  +        p.peek();
  +        control.setReturnValue(t);
  +
  +        p.getContributingModule();
  +        control.setReturnValue(m);
  +
  +        control.replay();
  +
           SetModuleRule rule = new SetModuleRule();
   
           rule.setPropertyName("module");
   
  -        processor.push(t);
  -        rule.begin(processor, null);
  +        rule.begin(p, null);
  +
  +        assertSame(m, t.getModule());
   
  -        assertSame(processor.getContributingModule(), t.getModule());
  +        control.verify();
       }
   }
  
  
  
  1.5       +3 -3      
jakarta-hivemind/framework/src/test/hivemind/test/rules/WrongType.xml
  
  Index: WrongType.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/rules/WrongType.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- WrongType.xml     13 May 2004 11:04:47 -0000      1.4
  +++ WrongType.xml     19 May 2004 15:08:47 -0000      1.5
  @@ -13,9 +13,9 @@
                                        <read-content property="key"/>
                                </rules>
                        </element>
  -                     <element name="value">
  +                     <element name="value" content-translator="object">
                                <rules>
  -                                     <read-content property="value" 
translator="object"/>
  +                                     <read-content property="value"/>
                                </rules>
                        </element>
                </element>
  
  
  
  1.2       +16 -4     
jakarta-hivemind/framework/src/test/hivemind/test/rules/TestPushAttributeRule.java
  
  Index: TestPushAttributeRule.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/rules/TestPushAttributeRule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestPushAttributeRule.java        19 May 2004 02:30:54 -0000      1.1
  +++ TestPushAttributeRule.java        19 May 2004 15:08:47 -0000      1.2
  @@ -16,8 +16,11 @@
   
   import org.apache.hivemind.Attribute;
   import org.apache.hivemind.impl.AttributeImpl;
  +import org.apache.hivemind.impl.DefaultClassResolver;
   import org.apache.hivemind.impl.ElementImpl;
  +import org.apache.hivemind.internal.Module;
   import org.apache.hivemind.schema.SchemaProcessor;
  +import org.apache.hivemind.schema.rules.NullTranslator;
   import org.apache.hivemind.schema.rules.PushAttributeRule;
   import org.apache.hivemind.test.HiveMindTestCase;
   import org.easymock.MockControl;
  @@ -41,19 +44,28 @@
   
           SchemaProcessor mockProcessor = (SchemaProcessor) control.getMock();
   
  -             mockProcessor.getContributingModule();
  -             control.setReturnValue(null);
  -             
  +        mockProcessor.getAttributeTranslator("fred");
  +        control.setReturnValue(new NullTranslator());
  +
  +        mockProcessor.getContributingModule();
  +
  +        MockControl moduleControl = 
MockControl.createStrictControl(Module.class);
  +        Module m = (Module) moduleControl.getMock();
  +
  +        control.setReturnValue(m);
  +
           mockProcessor.push("flintstone");
           mockProcessor.pop();
  -        
  +
           control.setReturnValue("flintstone");
   
           control.replay();
  +        moduleControl.replay();
   
           rule.begin(mockProcessor, element);
           rule.end(mockProcessor, element);
   
           control.verify();
  +        moduleControl.verify();
       }
   }
  
  
  
  1.3       +63 -49    
jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/SchemaProcessor.java
  
  Index: SchemaProcessor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/SchemaProcessor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SchemaProcessor.java      13 May 2004 11:04:47 -0000      1.2
  +++ SchemaProcessor.java      19 May 2004 15:08:47 -0000      1.3
  @@ -25,52 +25,66 @@
    */
   public interface SchemaProcessor
   {
  -     /**
  -      * The SchemaProcessor is always the bottom (deepest) object on the 
stack.
  -      * Top level objects (contained by a schema, not another element)
  -      * can use an [EMAIL PROTECTED] 
org.apache.hivemind.schema.rules.InvokeParentRule}
  -      * to add themselves to the list of elements for the
  -      * [EMAIL PROTECTED] org.apache.hivemind.ConfigurationPoint} being 
constructed.
  -      */
  -     public void addElement(Object element);
  -     
  -     /**
  -      * Pushes an object onto the processor's stack.
  -      */
  -     public void push(Object object);
  -     
  -     /**
  -      * Pops the top object off the stack and returns it.
  -      */
  -     
  -     public Object pop();
  -     
  -     /**
  -      * Peeks at the top object on the stack.
  -      * 
  -      **/
  -     
  -     public Object peek();
  -     
  -     /**
  -      * Peeks at an object within the stack at the indicated depth.
  -      */
  -     
  -     public Object peek(int depth);
  -     
  -     /**
  -      * Returns the module which contributed the current elements being 
processed.
  -      * 
  -      **/
  -     
  -     public Module getContributingModule();
  -
  -     /**
  -      * Returns the path to the current element in the form a sequence
  -      * of element names separated with slashes.  This is most often
  -      * used in error messages, to help identify the position of
  -      * an error.
  -      */
  -     
  -     public String getElementPath();
  +    /**
  +     * The SchemaProcessor is always the bottom (deepest) object on the 
stack.
  +     * Top level objects (contained by a schema, not another element)
  +     * can use an [EMAIL PROTECTED] 
org.apache.hivemind.schema.rules.InvokeParentRule}
  +     * to add themselves to the list of elements for the
  +     * [EMAIL PROTECTED] org.apache.hivemind.ConfigurationPoint} being 
constructed.
  +     */
  +    public void addElement(Object element);
  +
  +    /**
  +     * Pushes an object onto the processor's stack.
  +     */
  +    public void push(Object object);
  +
  +    /**
  +     * Pops the top object off the stack and returns it.
  +     */
  +
  +    public Object pop();
  +
  +    /**
  +     * Peeks at the top object on the stack.
  +     * 
  +     **/
  +
  +    public Object peek();
  +
  +    /**
  +     * Peeks at an object within the stack at the indicated depth.
  +     */
  +
  +    public Object peek(int depth);
  +
  +    /**
  +     * Returns the module which contributed the current elements being 
processed.
  +     * 
  +     **/
  +
  +    public Module getContributingModule();
  +
  +    /**
  +     * Returns the path to the current element in the form a sequence
  +     * of element names separated with slashes.  This is most often
  +     * used in error messages, to help identify the position of
  +     * an error.
  +     */
  +
  +    public String getElementPath();
  +
  +    /**
  +     * Returns a [EMAIL PROTECTED] org.apache.hivemind.schema.Translator} 
used to convert
  +     * the content of the current element. Will not return null.
  +     */
  +
  +    public Translator getContentTranslator();
  +
  +    /**
  +     * Returns the [EMAIL PROTECTED] org.apache.hivemind.schema.Translator} 
for a particular
  +     * attribute of the current element. Will not return null.
  +     */
  +
  +    public Translator getAttributeTranslator(String attributeName);
   }
  
  
  
  1.2       +8 -1      
jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/ElementModel.java
  
  Index: ElementModel.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/ElementModel.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ElementModel.java 26 Feb 2004 23:07:38 -0000      1.1
  +++ ElementModel.java 19 May 2004 15:08:47 -0000      1.2
  @@ -44,4 +44,11 @@
        
        public List getRules();
        
  +     /**
  +      * Returns the translator used for character content within the body of 
the element; may
  +      * return null.
  +      */
  +     
  +     public String getContentTranslator();
  +     
   }
  
  
  
  1.2       +8 -1      
jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/AttributeModel.java
  
  Index: AttributeModel.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/AttributeModel.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AttributeModel.java       26 Feb 2004 23:07:38 -0000      1.1
  +++ AttributeModel.java       19 May 2004 15:08:47 -0000      1.2
  @@ -36,4 +36,11 @@
         * the attribute is optional and may be omitted.
         */
        public boolean isRequired();
  +     
  +     /**
  +      * Returns the translator used to convert the attribute value. This is 
used
  +      * to locate a [EMAIL PROTECTED] org.apache.hivemind.schema.Translator}.
  +      */
  +     
  +     public String getTranslator();
   }
  
  
  
  1.6       +7 -20     
jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/ReadAttributeRule.java
  
  Index: ReadAttributeRule.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/ReadAttributeRule.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ReadAttributeRule.java    19 May 2004 02:30:53 -0000      1.5
  +++ ReadAttributeRule.java    19 May 2004 15:08:47 -0000      1.6
  @@ -33,29 +33,23 @@
    */
   public class ReadAttributeRule extends BaseRule
   {
  +
       private static final Log LOG = 
LogFactory.getLog(ReadAttributeRule.class);
   
       private String _attributeName;
       private String _propertyName;
       private boolean _skipIfNull = true;
  -    private String _translator;
  -    private Translator _translatorObject;
   
       public ReadAttributeRule()
       {
       }
   
  -    public ReadAttributeRule(
  -        String attributeName,
  -        String propertyName,
  -        String translator,
  -        Location location)
  +    public ReadAttributeRule(String attributeName, String propertyName, 
Location location)
       {
  +        setLocation(location);
  +
           _attributeName = attributeName;
           _propertyName = propertyName;
  -        _translator = translator;
  -
  -        setLocation(location);
       }
   
       public void begin(SchemaProcessor processor, Element element)
  @@ -71,13 +65,11 @@
   
           try
           {
  -            if (_translatorObject == null)
  -                _translatorObject = RuleUtils.getTranslator(processor, 
_translator);
  +            Translator t = processor.getAttributeTranslator(_attributeName);
   
               Class propertyType = PropertyUtils.getPropertyType(target, 
_propertyName, this);
   
  -            Object finalValue =
  -                
_translatorObject.translate(processor.getContributingModule(), propertyType, 
value);
  +            Object finalValue = 
t.translate(processor.getContributingModule(), propertyType, value);
   
               PropertyUtils.write(target, _propertyName, finalValue, this);
   
  @@ -96,11 +88,6 @@
               LOG.error(message, ex);
           }
   
  -    }
  -
  -    public void setTranslator(String translator)
  -    {
  -        _translator = translator;
       }
   
       public String getAttributeName()
  
  
  
  1.5       +3 -12     
jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/ReadContentRule.java
  
  Index: ReadContentRule.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/ReadContentRule.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ReadContentRule.java      19 May 2004 02:30:53 -0000      1.4
  +++ ReadContentRule.java      19 May 2004 15:08:47 -0000      1.5
  @@ -40,8 +40,6 @@
       private static final Log LOG = LogFactory.getLog(ReadContentRule.class);
   
       private String _propertyName;
  -    private String _translator;
  -    private Translator _translatorObject;
   
       public void begin(SchemaProcessor processor, Element element)
       {
  @@ -49,15 +47,13 @@
   
           try
           {
  -            if (_translatorObject == null)
  -                _translatorObject = RuleUtils.getTranslator(processor, 
_translator);
  +            Translator t = processor.getContentTranslator();
   
               Object target = processor.peek();
   
               Class propertyType = PropertyUtils.getPropertyType(target, 
_propertyName, this);
   
  -            Object finalValue =
  -                
_translatorObject.translate(processor.getContributingModule(), propertyType, 
value);
  +            Object finalValue = 
t.translate(processor.getContributingModule(), propertyType, value);
   
               PropertyUtils.write(target, _propertyName, finalValue, this);
           }
  @@ -83,11 +79,6 @@
       public void setPropertyName(String string)
       {
           _propertyName = string;
  -    }
  -
  -    public void setTranslator(String translator)
  -    {
  -        _translator = translator;
       }
   
   }
  
  
  
  1.3       +3 -16     
jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/PushAttributeRule.java
  
  Index: PushAttributeRule.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/PushAttributeRule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PushAttributeRule.java    19 May 2004 10:34:04 -0000      1.2
  +++ PushAttributeRule.java    19 May 2004 15:08:47 -0000      1.3
  @@ -28,8 +28,6 @@
   public class PushAttributeRule extends BaseRule
   {
       private String _attributeName;
  -    private String _translator;
  -    private Translator _translatorObject;
   
       /**
        * Uses the translator to convert the specified attribute into an object 
and pushes
  @@ -37,13 +35,12 @@
        */
       public void begin(SchemaProcessor processor, Element element)
       {
  -        if (_translatorObject == null)
  -            _translatorObject = RuleUtils.getTranslator(processor, 
_translator);
  +        Translator t = processor.getAttributeTranslator(_attributeName);
   
           String attributeValue = element.getAttributeValue(_attributeName);
   
           Object finalValue =
  -            _translatorObject.translate(processor.getContributingModule(), 
null, attributeValue);
  +            t.translate(processor.getContributingModule(), null, 
attributeValue);
   
           processor.push(finalValue);
       }
  @@ -61,19 +58,9 @@
           _attributeName = string;
       }
   
  -    public void setTranslator(String string)
  -    {
  -        _translator = string;
  -    }
  -
       public String getAttributeName()
       {
           return _attributeName;
  -    }
  -
  -    public String getTranslator()
  -    {
  -        return _translator;
       }
   
   }
  
  
  
  1.4       +3 -3      
jakarta-hivemind/framework/src/test/hivemind/test/config/BooleanTranslator.xml
  
  Index: BooleanTranslator.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/config/BooleanTranslator.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BooleanTranslator.xml     13 May 2004 11:04:41 -0000      1.3
  +++ BooleanTranslator.xml     19 May 2004 15:08:47 -0000      1.4
  @@ -5,10 +5,10 @@
        
                <schema id="Flag">
                        <element name="flag">
  -                       <attribute name="value" required="true"/>
  +                       <attribute name="value" required="true" 
translator="boolean"/>
                                <rules>
                                        <create-object 
class="hivemind.test.config.impl.BooleanHolder"/>
  -                                     <read-attribute property="value" 
attribute="value" translator="boolean"/>
  +                                     <read-attribute property="value" 
attribute="value"/>
                                        <invoke-parent method="addElement"/>
                                </rules>
                        </element>
  
  
  
  1.3       +3 -3      
jakarta-hivemind/framework/src/test/hivemind/test/config/ConversionParentMethod.xml
  
  Index: ConversionParentMethod.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/config/ConversionParentMethod.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConversionParentMethod.xml        13 May 2004 11:04:41 -0000      1.2
  +++ ConversionParentMethod.xml        19 May 2004 15:08:47 -0000      1.3
  @@ -6,11 +6,11 @@
                <element name="data-item">
                        <attribute name="item-name" required="true"/>
                        <attribute name="count"/>
  -                     <attribute name="service-id"/>
  +                     <attribute name="service-id" translator="service"/>
                        <conversion class="hivemind.test.config.DataItem"
                                parent-method="addElement">
                                <map attribute="item-name" property="name"/>
  -                             <map attribute="service-id" property="factory" 
translator="service"/>
  +                             <map attribute="service-id" property="factory"/>
                        </conversion>
                </element>
        </schema>
  
  
  
  1.4       +3 -3      
jakarta-hivemind/framework/src/test/hivemind/test/config/ResourceTranslator.xml
  
  Index: ResourceTranslator.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/config/ResourceTranslator.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ResourceTranslator.xml    13 May 2004 11:04:41 -0000      1.3
  +++ ResourceTranslator.xml    19 May 2004 15:08:47 -0000      1.4
  @@ -3,10 +3,10 @@
   <module id="hivemind.test.config" version="1.0.0">
        <configuration-point id="ResourceTranslator" schema-id="Resource"/>
        <schema id="Resource">
  -             <element name="resource">
  +             <element name="resource" content-translator="resource">
                        <rules>
                                <create-object 
class="hivemind.test.config.impl.ResourceHolder"/>
  -                             <read-content property="resource" 
translator="resource"/>
  +                             <read-content property="resource"/>
                                <invoke-parent method="addElement"/>
                        </rules>
                </element>
  
  
  
  1.4       +3 -3      
jakarta-hivemind/framework/src/test/hivemind/test/config/IntTranslator.xml
  
  Index: IntTranslator.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/config/IntTranslator.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IntTranslator.xml 13 May 2004 11:04:41 -0000      1.3
  +++ IntTranslator.xml 19 May 2004 15:08:47 -0000      1.4
  @@ -5,10 +5,10 @@
        
                <schema id="Int">
                        <element name="int">
  -                       <attribute name="value" required="true"/>
  +                       <attribute name="value" required="true" 
translator="int,min=5,max=10,default=6"/>
                                <rules>
                                        <create-object 
class="hivemind.test.config.impl.IntHolder"/>
  -                                     <read-attribute property="value" 
attribute="value" translator="int,min=5,max=10,default=6"/>
  +                                     <read-attribute property="value" 
attribute="value"/>
                                        <invoke-parent method="addElement"/>
                                </rules>
                        </element>
  
  
  
  1.3       +3 -4      
jakarta-hivemind/framework/src/test/hivemind/test/config/ObjectTranslator.xml
  
  Index: ObjectTranslator.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/config/ObjectTranslator.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ObjectTranslator.xml      13 May 2004 11:04:41 -0000      1.2
  +++ ObjectTranslator.xml      19 May 2004 15:08:47 -0000      1.3
  @@ -4,11 +4,10 @@
        <configuration-point id="ObjectTranslator" schema-id="Frobable"/>
        <schema id="Frobable">
                <element name="frobable">
  -                     <attribute name="class" required="true"/>
  +                     <attribute name="class" required="true" 
translator="object"/>
                        <rules>
                                <create-object 
class="hivemind.test.config.impl.FrobableHolder"/>
  -                             <read-attribute property="frobable" 
attribute="class"
  -                                     translator="object"/>
  +                             <read-attribute property="frobable" 
attribute="class"/>
                                <invoke-parent method="addElement"/>
                        </rules>
                </element>
  
  
  
  1.3       +3 -3      
jakarta-hivemind/framework/src/test/hivemind/test/config/DuplicateAttribute.xml
  
  Index: DuplicateAttribute.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/config/DuplicateAttribute.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DuplicateAttribute.xml    13 May 2004 11:04:41 -0000      1.2
  +++ DuplicateAttribute.xml    19 May 2004 15:08:47 -0000      1.3
  @@ -6,10 +6,10 @@
                <element name="data-item">
                        <attribute name="item-name" required="true"/>
                        <attribute name="count"/>
  -                     <attribute name="service-id"/>
  +                     <attribute name="service-id" translator="service"/>
                        <conversion class="hivemind.test.config.DataItem">
                                <map attribute="item-name" property="name"/>
  -                             <map attribute="service-id" property="factory" 
translator="service"/>
  +                             <map attribute="service-id" property="factory"/>
                                <map attribute="item-name" property="fred"/>
                        </conversion>
                </element>
  
  
  
  1.3       +3 -5      
jakarta-hivemind/framework/src/test/hivemind/test/config/Basics2.xml
  
  Index: Basics2.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/config/Basics2.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Basics2.xml       13 May 2004 11:04:41 -0000      1.2
  +++ Basics2.xml       19 May 2004 15:08:47 -0000      1.3
  @@ -6,10 +6,8 @@
                <element name="data-item">
                        <attribute name="name" required="true"/>
                        <attribute name="count"/>
  -                     <attribute name="factory"/>
  -                     <conversion class="hivemind.test.config.DataItem">
  -                             <map attribute="factory" translator="service"/>
  -                     </conversion>
  +                     <attribute name="factory" translator="service"/>
  +                     <conversion class="hivemind.test.config.DataItem"/>
                </element>
        </schema>
        <contribution configuration-id="Basics2">
  
  
  
  1.3       +3 -3      
jakarta-hivemind/framework/src/test/hivemind/test/config/Basics.xml
  
  Index: Basics.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/config/Basics.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Basics.xml        13 May 2004 11:04:41 -0000      1.2
  +++ Basics.xml        19 May 2004 15:08:48 -0000      1.3
  @@ -6,10 +6,10 @@
                <element name="data-item">
                        <attribute name="item-name" required="true"/>
                        <attribute name="count"/>
  -                     <attribute name="service-id"/>
  +                     <attribute name="service-id" translator="service"/>
                        <conversion class="hivemind.test.config.DataItem">
                                <map attribute="item-name" property="name"/>
  -                             <map attribute="service-id" property="factory" 
translator="service"/>
  +                             <map attribute="service-id" property="factory"/>
                        </conversion>
                </element>
        </schema>
  
  
  
  1.3       +3 -4      
jakarta-hivemind/framework/src/test/hivemind/test/config/ExtraAttributeNames.xml
  
  Index: ExtraAttributeNames.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/config/ExtraAttributeNames.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExtraAttributeNames.xml   13 May 2004 11:04:41 -0000      1.2
  +++ ExtraAttributeNames.xml   19 May 2004 15:08:48 -0000      1.3
  @@ -6,10 +6,9 @@
                <element name="data-item">
                        <attribute name="name" required="true"/>
                        <attribute name="count"/>
  -                     <attribute name="factory"/>
  +                     <attribute name="factory" translator="service"/>
                        <conversion class="hivemind.test.config.DataItem">
  -                             <map attribute="factory" translator="service"/>
  -                             <map attribute="extra"/>
  +                             <map attribute="extra" 
property="extraProperty"/>
                        </conversion>
                </element>
        </schema>
  
  
  
  1.6       +4 -6      
jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.properties
  
  Index: DescriptorParser.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DescriptorParser.properties       19 May 2004 02:30:54 -0000      1.5
  +++ DescriptorParser.properties       19 May 2004 15:08:48 -0000      1.6
  @@ -43,9 +43,11 @@
   required.interceptor.service-id=true
   
   required.element.name=true
  +required.element.content-translator=false
   
   required.attribute.name=true
   required.attribute.required=false
  +required.attribute.translator=false
   
   required.create-object.class=true
   
  @@ -57,10 +59,8 @@
   required.read-attribute.property=true
   required.read-attribute.attribute=true
   required.read-attribute.skip-if-null=false
  -required.read-attribute.translator=false
   
   required.read-content.property=true
  -required.read-content.translator=false
   
   required.invoke-factory.service-id=true
   required.invoke-factory.model=false
  @@ -75,8 +75,7 @@
   required.conversion.parent-method=false
   
   required.map.attribute=true
  -required.map.property=false
  -required.map.translator=false
  +required.map.property=true
   
   
   required.sub-module.descriptor=true
  @@ -85,4 +84,3 @@
   required.set-property.value=true
   
   required.push-attribute.attribute=true
  -required.push-attribute.translator=false
  
  
  
  1.4       +1 -3      
jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ConversionDescriptor.java
  
  Index: ConversionDescriptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ConversionDescriptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ConversionDescriptor.java 13 May 2004 11:04:44 -0000      1.3
  +++ ConversionDescriptor.java 19 May 2004 15:08:48 -0000      1.4
  @@ -128,7 +128,6 @@
                       new ReadAttributeRule(
                           attributeName,
                           constructPropertyName(attributeName),
  -                        _defaultTranslator,
                           getLocation()));
               }
               else
  @@ -141,7 +140,6 @@
                       new ReadAttributeRule(
                           attributeName,
                           propertyName,
  -                        amd.getTranslator(),
                           amd.getLocation()));
   
                   _attributeMappings.remove(attributeName);
  
  
  
  1.3       +1 -13     
jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/AttributeMappingDescriptor.java
  
  Index: AttributeMappingDescriptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/AttributeMappingDescriptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AttributeMappingDescriptor.java   13 May 2004 11:04:44 -0000      1.2
  +++ AttributeMappingDescriptor.java   19 May 2004 15:08:48 -0000      1.3
  @@ -28,7 +28,6 @@
   {
       private String _attributeName;
       private String _propertyName;
  -    private String _translator;
   
       public String getAttributeName()
       {
  @@ -40,11 +39,6 @@
           return _propertyName;
       }
   
  -    public String getTranslator()
  -    {
  -        return _translator;
  -    }
  -
       public void setAttributeName(String string)
       {
           _attributeName = string;
  @@ -54,10 +48,4 @@
       {
           _propertyName = string;
       }
  -
  -    public void setTranslator(String translator)
  -    {
  -        _translator = translator;
  -    }
  -
   }
  
  
  
  1.14      +4 -11     
jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.java
  
  Index: DescriptorParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DescriptorParser.java     19 May 2004 02:30:54 -0000      1.13
  +++ DescriptorParser.java     19 May 2004 15:08:48 -0000      1.14
  @@ -373,12 +373,6 @@
               amd.setAttributeName(getAttribute("attribute"));
               amd.setPropertyName(getAttribute("property"));
   
  -            String translator = getAttribute("translator");
  -            if (translator == null)
  -                translator = "smart";
  -
  -            amd.setTranslator(translator);
  -
               cd.addAttributeMapping(amd);
   
               return;
  @@ -785,6 +779,7 @@
   
           attributeModel.setName(getAttribute("name"));
           attributeModel.setRequired(getBooleanAttribute("required", false));
  +        attributeModel.setTranslator(getAttribute("translator", "smart"));
   
           elementModel.addAttributeModel(attributeModel);
       }
  @@ -916,6 +911,7 @@
           checkAttributes();
   
           result.setElementName(getAttribute("name"));
  +        result.setContentTranslator(getAttribute("content-translator"));
   
           return result;
       }
  @@ -1030,7 +1026,6 @@
           rule.setPropertyName(getAttribute("property"));
           rule.setAttributeName(getAttribute("attribute"));
           rule.setSkipIfNull(getBooleanAttribute("skip-if-null", true));
  -        rule.setTranslator(getAttribute("translator"));
   
           elementModel.addRule(rule);
       }
  @@ -1045,7 +1040,6 @@
           checkAttributes();
   
           rule.setPropertyName(getAttribute("property"));
  -        rule.setTranslator(getAttribute("translator"));
   
           elementModel.addRule(rule);
       }
  @@ -1148,8 +1142,7 @@
           checkAttributes();
   
           rule.setAttributeName(getAttribute("attribute"));
  -        rule.setTranslator(getAttribute("translator"));
  -        
  +
           elementModel.addRule(rule);
       }
   
  
  
  
  1.2       +3 -3      jakarta-hivemind/xdocs/sdl.xml
  
  Index: sdl.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/xdocs/sdl.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sdl.xml   28 Apr 2004 23:31:17 -0000      1.1
  +++ sdl.xml   19 May 2004 15:08:49 -0000      1.2
  @@ -94,12 +94,12 @@
         <element name="processor">
          
            <attribute name="name" required="true"/>
  -         <attribute name="service-id" required="true"/>
  +         <attribute name="service-id" required="true" translator="service"/>
            <attribute name="before"/>
            <attribute name="after"/>
            
            <conversion class="some.module.PipelineContribution">
  -           <map property="controlService" attribute="service-id" 
translator="service"/>
  +           <map property="controlService" attribute="service-id"/>
            </conversion>
         
         </element>
  
  
  
  1.17      +5 -5      jakarta-hivemind/xdocs/case1.xml
  
  Index: case1.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/xdocs/case1.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- case1.xml 13 May 2004 11:04:48 -0000      1.16
  +++ case1.xml 19 May 2004 15:08:49 -0000      1.17
  @@ -120,20 +120,20 @@
                                description { "Title displayed as task is 
executed." }
                        }
                        
  -                     attribute (name=class)
  +                     attribute (name=class translator=object)
                        {
                                description { "Name of class implementing the 
Executable interface." }
                        }
                        
  -                     attribute (name=service-id)
  +                     attribute (name=service-id translator=service)
                        {
                                description { "Name of service implementing the 
Executable interface." }
                        }
                        
                        conversion 
(class=com.panorama.framework.startup.service.Task)
                        {
  -                             map (attribute=class property=executable 
translator=object)
  -                             map (attribute=service-id property=executable 
translator=service)
  +                             map (attribute=class property=executable)
  +                             map (attribute=service-id property=executable)
                                
                                // Other attribute map directly
                        }
  
  
  
  1.21      +8 -21     jakarta-hivemind/xdocs/rules.xml
  
  Index: rules.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/xdocs/rules.xml,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- rules.xml 19 May 2004 02:30:54 -0000      1.20
  +++ rules.xml 19 May 2004 15:08:49 -0000      1.21
  @@ -202,12 +202,6 @@
                                        <td>The name of the attribute to 
read.</td>
                                </tr>
   
  -                             <tr>
  -                                     <td>translator</td>     
  -                                     <td>string</td>
  -                                     <td>no</td>
  -                                     <td>See <a 
href="#Translators">Translators</a></td>
  -                             </tr>
                                </table>
        
   </subsection>
  @@ -246,12 +240,6 @@
                                        <td>If "true" (the default), then an 
omitted attribute will be ignored.  If "false",
                                                the property will be updated 
regardless.</td>
                                </tr>
  -                             <tr>
  -                                     <td>translator</td>     
  -                                     <td>string</td>
  -                                     <td>no</td>
  -                                     <td>See <a 
href="#Translators">Translators</a></td>
  -                             </tr>
                                </table>
                                
   </subsection>
  @@ -276,12 +264,6 @@
                                        <td>yes</td>
                                        <td>The name of the property of the top 
object on the stack to update.</td>
                                </tr>   
  -                             <tr>
  -                                     <td>translator</td>     
  -                                     <td>string</td>
  -                                     <td>no</td>
  -                                     <td>See <a 
href="#Translators">Translators</a></td>
  -                             </tr>
                                </table>        
   </subsection>
   
  @@ -380,8 +362,8 @@
   </p>
   
   <p>
  -Translators can be configured using initializer strings.  The initializer 
string is separated from the
  -translator id (or translator class name) by a comma, ex: 
<code>int,min=0</code>.  Initializer
  +Translators configurations consist of a translator name, and an optional 
initalizer string.  The initializer string is separated from the
  +translator id by a comma, ex: <code>int,min=0</code> (where 
<code>min=0</code> is the initializer string).  Initializer
   strings are generally in the format of
   <code>key=value[,key=value]*</code> ... but each Translator
   is free to interpret the initializer string its own way.
  @@ -572,6 +554,11 @@
   <ul>
   <li>default: the default value to use when the input is blank</li>
   </ul>
  +</p>
  +
  +<p>
  +<b>Note:</b>  this translator is hard-coded, and does not appear in
  +the <code>hivemind.Translators</code> configuration point.
   </p>
   
   </subsection>
  
  
  
  1.39      +27 -20    jakarta-hivemind/xdocs/descriptor.xml
  
  Index: descriptor.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/xdocs/descriptor.xml,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- descriptor.xml    17 May 2004 16:57:47 -0000      1.38
  +++ descriptor.xml    19 May 2004 15:08:49 -0000      1.39
  @@ -76,6 +76,15 @@
                                        <td>If true, the attribute must be 
provided in the contributed configuration element.
                                                The default is false.</td>
                                </tr>
  +                             <tr>
  +                                     <td>translator</td>     
  +                                     <td>string</td>
  +                                     <td>no</td>
  +                                     <td>The <a 
href="rules.html#Translators">translator</td> configuration 
  +                                             that is used
  +                                             to convert the attribute into a 
useable type. By default, the attribute is
  +                                             treated as a single string.
  +                             </tr>
                                </table>
                                
                                <p>
  @@ -288,6 +297,15 @@
                                        <td>yes</td>
                                        <td>The name of the element.</td>
                                </tr>   
  +                             <tr>
  +                                     <td>content-translator</td>     
  +                                     <td>string</td>
  +                                     <td>no</td>
  +                                     <td>The <a 
href="rules.html#Translators">translator</td> configuration 
  +                                             that is used
  +                                             to convert the element's 
content into a useable type. By default, the content is
  +                                             treated as a single string.
  +                             </tr>                           
                </table>
                
                <p>
  @@ -450,10 +468,11 @@
                        
                        <p>The &_map; element appears within &conversion;
                                to override the default mapping from an 
attribute to a property. By default, the
  -                             property name is expected to match the 
attribute name, and attribute value
  -                             is converted in accordance to the property 
type. When the property type is
  -                             not a primitive type, or the attribute should 
be interpreted specially (as
  -                             a reference to a service, perhaps), then 
translator should be specified.
  +                             property name is expected to match the 
attribute name
  +                             (with the name
  +                                     mangling described in the description of
  +                                     &conversion;); the &_map; element is 
used
  +                                     to handle exceptions to the rule. 
                                
                                </p>    
                                
  @@ -474,26 +493,14 @@
                                </tr>
                                                        
                                <tr>
  -                                     <td>property</td>        
<td>string</td> <td>no</td>
  +                                     <td>property</td>        
<td>string</td> <td>yes</td>
                                        <td>
                                        The corresponding property (of the Java 
object specified by the
  -                                     enclosing &conversion;). If not 
specified, the property name
  -                                     will be based upon the attribute name 
(with the same
  -                                     mangling described in the description of
  -                                     &conversion;).
  +                                     enclosing &conversion;)
                                        </td>
                                </tr>   
                                
  -                             <tr>
  -                                     <td>translator</td> <td>string</td> 
<td>no</td>
  -                                     <td>
  -                                     The <a 
href="&projectroot;rules.html#Translators">translator</a>
  -                                     used to convert the attribute value to 
a property value.
  -                                     If not specified, then the default 
translator will automatically convert
  -                                     the attribute value to a Java primitive 
type (or leave it as a string). 
  -                                     </td>
  -                                             
  -                             </tr>
  +
                                </table>
                                                                
                </section>
  
  
  
  1.2       +12 -1     
jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/impl/AttributeModelImpl.java
  
  Index: AttributeModelImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/impl/AttributeModelImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AttributeModelImpl.java   26 Feb 2004 23:08:02 -0000      1.1
  +++ AttributeModelImpl.java   19 May 2004 15:08:49 -0000      1.2
  @@ -27,6 +27,7 @@
   {
       private String _name;
       private boolean _required;
  +    private String _translator;
   
       public String getName()
       {
  @@ -46,6 +47,16 @@
       public void setRequired(boolean b)
       {
           _required = b;
  +    }
  +
  +    public String getTranslator()
  +    {
  +        return _translator;
  +    }
  +
  +    public void setTranslator(String string)
  +    {
  +        _translator = string;
       }
   
   }
  
  
  
  1.2       +13 -1     
jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/impl/ElementModelImpl.java
  
  Index: ElementModelImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/impl/ElementModelImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ElementModelImpl.java     26 Feb 2004 23:08:02 -0000      1.1
  +++ ElementModelImpl.java     19 May 2004 15:08:49 -0000      1.2
  @@ -35,6 +35,8 @@
       private List _shareableAttributeModels;
       private List _rules;
       private List _shareableRules;
  +    private String _contentTranslator;
  +    
       public String getElementName()
       {
           return _elementName;
  @@ -83,4 +85,14 @@
           return _shareableRules;
       }
       
  +    public String getContentTranslator()
  +    {
  +        return _contentTranslator;
  +    }
  +
  +    public void setContentTranslator(String string)
  +    {
  +        _contentTranslator = string;
  +    }
  +
   }
  
  
  
  1.3       +26 -5     
jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/SchemaProcessorImpl.java
  
  Index: SchemaProcessorImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/SchemaProcessorImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SchemaProcessorImpl.java  13 May 2004 11:04:43 -0000      1.2
  +++ SchemaProcessorImpl.java  19 May 2004 15:08:49 -0000      1.3
  @@ -27,6 +27,8 @@
   import org.apache.hivemind.schema.ElementModel;
   import org.apache.hivemind.schema.Schema;
   import org.apache.hivemind.schema.SchemaProcessor;
  +import org.apache.hivemind.schema.Translator;
  +import org.apache.hivemind.schema.rules.NullTranslator;
   
   /**
    * Used to assemble all the [EMAIL PROTECTED] 
org.apache.hivemind.Contribution}s
  @@ -74,7 +76,7 @@
               for (int i = 0; i < count; i++)
               {
                   ElementModel model = (ElementModel) l.get(i);
  -                _elementMap.put(model.getElementName(), new 
SchemaElement(model));
  +                _elementMap.put(model.getElementName(), new 
SchemaElement(this, model));
               }
           }
       }
  @@ -179,6 +181,8 @@
           processElement(element, schemaElement);
       }
   
  +    private SchemaElement _activeElement;
  +
       private void processElement(Element element, SchemaElement schemaElement)
       {
           String name = element.getElementName();
  @@ -193,12 +197,19 @@
                       element.getLocation()));
           else
           {
  -            schemaElement.validateAttributes(this, element);
  -            schemaElement.fireBegin(this, element);
  +            SchemaElement prior = _activeElement;
  +
  +            schemaElement.validateAttributes(element);
  +
  +            _activeElement = schemaElement;
  +
  +            schemaElement.fireBegin(element);
   
               processNestedElements(element, schemaElement);
   
  -            schemaElement.fireEnd(this, element);
  +            schemaElement.fireEnd(element);
  +
  +            _activeElement = prior;
           }
   
           popElement();
  @@ -216,5 +227,15 @@
   
               processElement(nested, schemaElement.getNestedElement(name));
           }
  +    }
  +
  +    public Translator getContentTranslator()
  +    {
  +        return _activeElement.getContentTranslator();
  +    }
  +    
  +    public Translator getAttributeTranslator(String attributeName)
  +    {
  +     return _activeElement.getAttributeTranslator(attributeName);
       }
   }
  
  
  
  1.2       +45 -9     
jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/SchemaElement.java
  
  Index: SchemaElement.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/SchemaElement.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SchemaElement.java        26 Feb 2004 23:07:40 -0000      1.1
  +++ SchemaElement.java        19 May 2004 15:08:49 -0000      1.2
  @@ -30,6 +30,8 @@
   import org.apache.hivemind.schema.ElementModel;
   import org.apache.hivemind.schema.Rule;
   import org.apache.hivemind.schema.SchemaProcessor;
  +import org.apache.hivemind.schema.Translator;
  +import org.apache.hivemind.schema.rules.NullTranslator;
   
   /**
    * A wrapper around [EMAIL PROTECTED] 
org.apache.hivemind.schema.ElementModel} used
  @@ -41,13 +43,19 @@
   
   final class SchemaElement
   {
  +    private SchemaProcessor _processor;
       private ElementModel _model;
       private List _requiredAttributes;
       private Set _knownAttributes;
       private Map _nestedElements;
  +    /**
  +     * Keyed on attribute name, value is string (possibly null) used to 
access a translator.
  +     */
  +    private Map _attributeTranslators = new HashMap();
   
  -    SchemaElement(ElementModel model)
  +    SchemaElement(SchemaProcessor processor, ElementModel model)
       {
  +        _processor = processor;
           _model = model;
   
           _requiredAttributes = new ArrayList();
  @@ -66,6 +74,8 @@
   
               if (am.isRequired())
                   _requiredAttributes.add(name);
  +
  +            _attributeTranslators.put(name, am.getTranslator());
           }
       }
   
  @@ -92,7 +102,7 @@
           {
               ElementModel nested = (ElementModel) l.get(i);
   
  -            SchemaElement nestedElement = new SchemaElement(nested);
  +            SchemaElement nestedElement = new SchemaElement(_processor, 
nested);
   
               // TODO: Check for duplicates here, or at parse!
   
  @@ -107,7 +117,7 @@
        * Validation errors result in logged error messages.
        * 
        */
  -    void validateAttributes(SchemaProcessor processor, Element element)
  +    void validateAttributes(Element element)
       {
           List l = element.getAttributes();
           int count = l.size();
  @@ -144,7 +154,7 @@
           buffer.append(
               HiveMind.format(
                   "SchemaElement.element-errors",
  -                processor.getElementPath(),
  +                _processor.getElementPath(),
                   element.getLocation()));
   
           for (int i = 0; i < count; i++)
  @@ -156,7 +166,7 @@
           throw new ApplicationRuntimeException(buffer.toString(), 
element.getLocation(), null);
       }
   
  -    void fireBegin(SchemaProcessor processor, Element element)
  +    void fireBegin(Element element)
       {
           List rules = _model.getRules();
           int count = rules.size();
  @@ -165,12 +175,12 @@
           {
               Rule r = (Rule) rules.get(i);
   
  -            r.begin(processor, element);
  +            r.begin(_processor, element);
   
           }
       }
   
  -    void fireEnd(SchemaProcessor processor, Element element)
  +    void fireEnd(Element element)
       {
           List rules = _model.getRules();
           int count = rules.size();
  @@ -179,8 +189,34 @@
           {
               Rule r = (Rule) rules.get(i);
   
  -            r.end(processor, element);
  +            r.end(_processor, element);
   
           }
  +    }
  +
  +    private Translator _nullTranslator = new NullTranslator();
  +    private Translator _contentTranslator;
  +
  +    public Translator getContentTranslator()
  +    {
  +        if (_contentTranslator == null)
  +            _contentTranslator = 
getTranslator(_model.getContentTranslator());
  +
  +        return _contentTranslator;
  +    }
  +
  +    private Translator getTranslator(String translator)
  +    {
  +        if (translator == null)
  +            return _nullTranslator;
  +
  +        return _processor.getContributingModule().getTranslator(translator);
  +    }
  +
  +    public Translator getAttributeTranslator(String attributeName)
  +    {
  +        String translator = (String) 
_attributeTranslators.get(attributeName);
  +
  +        return getTranslator(translator);
       }
   }
  
  
  
  1.8       +3 -1      
jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryImpl.java
  
  Index: RegistryImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RegistryImpl.java 19 May 2004 02:30:52 -0000      1.7
  +++ RegistryImpl.java 19 May 2004 15:08:49 -0000      1.8
  @@ -37,6 +37,7 @@
   import org.apache.hivemind.order.Orderer;
   import org.apache.hivemind.schema.Translator;
   import org.apache.hivemind.schema.rules.ClassTranslator;
  +import org.apache.hivemind.schema.rules.SmartTranslator;
   import org.apache.hivemind.service.ThreadEventNotifier;
   import org.apache.hivemind.util.ToStringBuilder;
   
  @@ -88,6 +89,7 @@
           // processing of the hivemind.Translators configuration point.
   
           _translatorClasses.put("class", ClassTranslator.class);
  +        _translatorClasses.put("smart", SmartTranslator.class);
       }
   
       public Locale getLocale()
  
  
  
  1.7       +44 -52    
jakarta-hivemind/framework/src/descriptor/META-INF/hivemodule.sdl
  
  Index: hivemodule.sdl
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/descriptor/META-INF/hivemodule.sdl,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- hivemodule.sdl    19 May 2004 02:30:54 -0000      1.6
  +++ hivemodule.sdl    19 May 2004 15:08:49 -0000      1.7
  @@ -33,12 +33,12 @@
                                        description { "A unique name used to 
identify the source, used when ordering the sources." }
                                }
                
  -                             attribute (name=class)
  +                             attribute (name=class translator=object)
                                {
                                        description { "Name of a class 
implementing the SymbolSource interface." }
                                }
   
  -                             attribute (name=service-id)
  +                             attribute (name=service-id translator=service)
                                {
                                        description { "Service configuration id 
for a service which implements the SymbolSource interface." }
                                }
  @@ -55,8 +55,8 @@
                
                                conversion 
(class=org.apache.hivemind.SymbolSourceContribution)
                                {
  -                                     map (attribute=class property=source 
translator=object)
  -                                     map (attribute=service-id 
property=source translator=service)
  +                                     map (attribute=class property=source)
  +                                     map (attribute=service-id 
property=source)
                                        map (attribute=before 
property=followingNames)
                                        map (attribute=after 
property=precedingNames)
                                }
  @@ -281,74 +281,74 @@
                                        }
                                }
                                        
  -                             element (name=int)
  +                             element (name=int content-translator=int)
                                {
                                        description { "An integer value 
constructor parameter." }
                                        
                                        rules
                                        {
                                                create-object 
(class=org.apache.hivemind.service.impl.BuilderPropertyFacet)
  -                                             read-content (property=value 
translator=int)
  +                                             read-content (property=value)
                                                invoke-parent 
(method=addParameter depth=4)
                                        }
                                }
                                
  -                             element (name=long)
  +                             element (name=long content-translator=long)
                                {
                                        description { "A long (64-bit) integer 
value constructor parameter." }
                        
                                        rules
                                        {
                                                create-object 
(class=org.apache.hivemind.service.impl.BuilderPropertyFacet)
  -                                             read-content (property=value 
translator=long)
  +                                             read-content (property=value)
                                                invoke-parent 
(method=addParameter depth=4)
                                        }               
                                }
   
  -                             element (name=boolean)
  +                             element (name=boolean 
content-translator="enumeration,java.lang.Boolean,true=TRUE,false=FALSE")
                                {
                                        description { "A boolean value 
constructor parameter." }
                        
                                        rules
                                        {
                                                create-object 
(class=org.apache.hivemind.service.impl.BuilderPropertyFacet)
  -                                             read-content (property=value 
translator="enumeration,java.lang.Boolean,true=TRUE,false=FALSE")
  +                                             read-content (property=value)
                                                invoke-parent 
(method=addParameter depth=4)
                                        }
                                }                               
   
  -                             element (name=service)
  +                             element (name=service 
content-translator=service)
                                {
                                        description { "A constructor parameter 
providing the identified HiveMind service." }
                                        
                                        rules
                                        {
                                                create-object 
(class=org.apache.hivemind.service.impl.BuilderPropertyFacet)
  -                                             read-content (property=value 
translator=service)
  +                                             read-content (property=value)
                                                invoke-parent 
(method=addParameter depth=4)
                                        }
                                }                       
        
  -                             element (name=configuration)
  +                             element (name=configuration 
content-translator=configuration)
                                {
                                        description { "A constructor parameter 
providing a HiveMind configuration point (as a List)." }
                                                
                                        rules
                                        {
                                                create-object 
(class=org.apache.hivemind.service.impl.BuilderPropertyFacet)
  -                                             read-content (property=value 
translator=configuration)
  +                                             read-content (property=value)
                                                invoke-parent 
(method=addParameter depth=4)
                                        }
                                }                                       
   
  -                             element (name=resource)
  +                             element (name=resource 
content-translator=resource)
                                {
                                        description { "A Resource constructor 
parameter." }
                                        
                                        rules
                                        {
                                                create-object 
(class=org.apache.hivemind.service.impl.BuilderPropertyFacet)
  -                                             read-content (property=value 
translator=resource)
  +                                             read-content (property=value)
                                                invoke-parent 
(method=addParameter depth=4)
                                        }
                                }                               
  @@ -422,7 +422,7 @@
                                                description { "The name of the 
property of the service instance to configure." }
                                        }
                                                
  -                                     attribute (name=service-id 
required=true)
  +                                     attribute (name=service-id 
required=true translator=service)
                                        {
                                                description { "The id of the 
service." }
                                        }
  @@ -431,7 +431,7 @@
                                        {
                                                create-object 
(class=org.apache.hivemind.service.impl.BuilderPropertyFacet)
                                                read-attribute 
(property=propertyName attribute=property)
  -                                             read-attribute (property=value 
attribute=service-id translator=service)
  +                                             read-attribute (property=value 
attribute=service-id)
                                                invoke-parent 
(method=addProperty depth=4)
                                        }
                                }
  @@ -449,7 +449,7 @@
                                                description { "The name of the 
property of the service instance to configure." }
                                        }
                                        
  -                                     attribute (name=configuration-id 
required=true)
  +                                     attribute (name=configuration-id 
required=true translator=configuration)
                                        {
                                                description { "The id of the 
configuration point to access." }
                                        }
  @@ -458,7 +458,7 @@
                                        {
                                                create-object 
(class=org.apache.hivemind.service.impl.BuilderPropertyFacet)
                                                read-attribute 
(property=propertyName attribute=property)
  -                                             read-attribute (property=value 
attribute=configuration-id translator=configuration)
  +                                             read-attribute (property=value 
attribute=configuration-id)
                                                invoke-parent 
(method=addProperty depth=4)
                                        }
                                }
  @@ -472,7 +472,7 @@
                                                description { "The name of the 
property of the service instance to configure." }
                                        }
                                        
  -                                     attribute (name=path required=true)
  +                                     attribute (name=path required=true 
translator=resource)
                                        {
                                                description { "The path, 
relative to the module's deployment descriptor, of the resource." }
                                        }
  @@ -481,7 +481,7 @@
                                        {
                                                create-object 
(class=org.apache.hivemind.service.impl.BuilderPropertyFacet)
                                                read-attribute 
(property=propertyName attribute=property)
  -                                             read-attribute (property=value 
attribute=path translator=resource)
  +                                             read-attribute (property=value 
attribute=path)
                                                invoke-parent 
(method=addProperty depth=4)
                                        }
                                }
  @@ -494,7 +494,7 @@
                                                "the specified service."
                                        }
                                        
  -                                     attribute (name=service-id 
required=true)
  +                                     attribute (name=service-id 
required=true translator=service)
                                        {
                                                description { "The service 
which will produce events." }
                                        }
  @@ -512,7 +512,7 @@
                                        rules
                                        {
                                                create-object 
(class=org.apache.hivemind.service.impl.EventRegistration)
  -                                             read-attribute 
(property=producer attribute=service-id translator=service)
  +                                             read-attribute 
(property=producer attribute=service-id)
                                                read-attribute 
(property=eventSetName attribute=event-set)
                                                invoke-parent 
(method=addEventRegistration depth=4)
                                        }
  @@ -572,14 +572,14 @@
                                        description { "The name of the service 
model, which must be unique." }
                                }
            
  -                             attribute (name=class required=false)
  +                             attribute (name=class required=false 
translator=object)
                                {
                                        description { "The name of the service 
model factory class to instantiate." }
                                }
                    
                                conversion 
(class=org.apache.hivemind.impl.ServiceModelContribution)
                                {
  -                                     map (attribute=class property=factory 
translator=object)
  +                                     map (attribute=class property=factory)
                                }
                        }
                }
  @@ -598,7 +598,7 @@
        {
                description
                {
  -                     "Used to define new translators that can be used in XML 
conversion rules. "
  +                     "Used to define new translators that can be used in 
contribution conversion rules. "
                        "Translators must have unique names."
                }
   
  @@ -610,39 +610,32 @@
                {
                        description { "Maps a translator name to a translator 
class." }
           
  +                     // Implicitly uses the smart translator, which is 
hard-coded.
  +                     
                        attribute (name=name required=true)
                        {
                        description { "A unique name for a translator." }
                        }
           
  -                     attribute (name=class required=true)
  +                     // "class" is also hard-coded translator
  +                     
  +                     attribute (name=class required=true translator=class)
                        {
                        description { "The class to instantiate, which must 
implement the Translator interface." }
                        }
           
  -                     rules
  +                     conversion 
(class=org.apache.hivemind.impl.TranslatorContribution)
                        {
  -                     create-object 
(class=org.apache.hivemind.impl.TranslatorContribution)
  -        
  -                             // If we used conversion instead of a set of 
rules, then
  -                             // the mapping of the name attribute would use 
the default
  -                             // translator, "smart", which we would also 
have to hard code. Perhaps
  -                             // we should?
  -        
  -                     read-attribute (attribute=name property=name)
  -         
  -                     // "class" is the only hard-coded translator, and is 
built-in for just this purpose
  - 
  -                     read-attribute (attribute=class 
property=translatorClass translator=class)
  -          
  -                     invoke-parent (method=addElement)
  +                       map (attribute=class property=translatorClass)
                        }
  -                     }
  +             }
                }  // schema
        }
        
        contribution (configuration-id=Translators)
        {
  +             // Note: smart and class are hard-coded
  +             
                translator (name=boolean       
class=org.apache.hivemind.schema.rules.BooleanTranslator)
                translator (name=object        
class=org.apache.hivemind.schema.rules.ObjectTranslator)
                translator (name=int           
class=org.apache.hivemind.schema.rules.IntTranslator)
  @@ -652,7 +645,6 @@
                translator (name=resource      
class=org.apache.hivemind.schema.rules.ResourceTranslator)
                translator (name=long          
class=org.apache.hivemind.schema.rules.LongTranslator)
                translator (name=double        
class=org.apache.hivemind.schema.rules.DoubleTranslator)
  -             translator (name=smart         
class=org.apache.hivemind.schema.rules.SmartTranslator)  
                translator (name=service-point 
class=org.apache.hivemind.schema.rules.ServicePointTranslator)           
        }
        
  @@ -683,14 +675,14 @@
                        {
                                description { "Defines a service that 
implements the Runnable interface." }
                 
  -                             attribute (name=service-id)
  +                             attribute (name=service-id translator=service)
                                {
                                description { "The name of a service 
implementing the Runnable interface." }
                                }
                        
                                rules
                                {
  -                                     push-attribute (attribute=service-id 
translator=service)
  +                                     push-attribute (attribute=service-id)
                                        invoke-parent (method=addElement)
                                }
                        } // element service
  @@ -699,14 +691,14 @@
                        {
                                description { "Allows an instance of a class 
implementing Runnable to be contributed." }
                        
  -                             attribute (name=class)
  +                             attribute (name=class translator=object)
                                {
                                        description { "The name of a class 
implementing Runnable." }
                                }
                        
                                rules
                                {
  -                                     push-attribute (attribute=class 
translator=object)
  +                                     push-attribute (attribute=class)
                                        invoke-parent (method=addElement)
                                }
                                
  @@ -745,11 +737,11 @@
                        {
                                description { "Identifies a service that will 
be eagerly loaded." }
                  
  -                             attribute (name=service-id required=true)
  +                             attribute (name=service-id required=true 
translator=service-point)
                        
                                rules
                                {
  -                                     push-attribute (attribute=service-id 
translator=service-point)
  +                                     push-attribute (attribute=service-id)
                                        invoke-parent (method=addElement)
                                }
                        }
  
  
  
  1.1                  
jakarta-hivemind/framework/src/test/org/apache/hivemind/impl/TestSchemaProcessor.java
  
  Index: TestSchemaProcessor.java
  ===================================================================
  //  Copyright 2004 The Apache Software Foundation
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  //     http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
  
  package org.apache.hivemind.impl;
  
  import hivemind.test.services.StringHolder;
  import hivemind.test.services.impl.StringHolderImpl;
  
  import java.util.Collections;
  import java.util.List;
  
  import org.apache.hivemind.Element;
  import org.apache.hivemind.internal.Module;
  import org.apache.hivemind.schema.impl.AttributeModelImpl;
  import org.apache.hivemind.schema.impl.ElementModelImpl;
  import org.apache.hivemind.schema.impl.SchemaImpl;
  import org.apache.hivemind.schema.rules.CreateObjectRule;
  import org.apache.hivemind.schema.rules.InvokeParentRule;
  import org.apache.hivemind.schema.rules.NullTranslator;
  import org.apache.hivemind.schema.rules.ReadAttributeRule;
  import org.apache.hivemind.schema.rules.ReadContentRule;
  import org.apache.hivemind.test.HiveMindTestCase;
  import org.easymock.MockControl;
  
  /**
   * Tests for [EMAIL PROTECTED] org.apache.hivemind.schema.SchemaProcessor} and
   * [EMAIL PROTECTED] org.apache.hivemind.impl.SchemaElement}.
   *
   * @author Howard Lewis Ship
   * @version $Id: TestSchemaProcessor.java,v 1.1 2004/05/19 15:08:49 hlship 
Exp $
   */
  public class TestSchemaProcessor extends HiveMindTestCase
  {
  
      public void testGetContentTranslator()
      {
          ElementModelImpl em = new ElementModelImpl();
  
          em.setElementName("fred");
          em.setContentTranslator("smart");
  
          em.addRule(new CreateObjectRule(StringHolderImpl.class.getName()));
  
          ReadContentRule rule = new ReadContentRule();
          rule.setPropertyName("value");
  
          em.addRule(rule);
  
          em.addRule(new InvokeParentRule("addElement"));
  
          SchemaImpl schema = new SchemaImpl();
          schema.addElementModel(em);
  
          SchemaProcessorImpl p = new SchemaProcessorImpl(schema);
  
          ElementImpl element = new ElementImpl();
          element.setElementName("fred");
          element.setContent("flintstone");
  
          List elements = Collections.singletonList(element);
  
          MockControl control = MockControl.createStrictControl(Module.class);
          Module m = (Module) control.getMock();
  
          m.getClassResolver();
          control.setReturnValue(new DefaultClassResolver());
  
          m.expandSymbols("flintstone", null);
          control.setReturnValue("flintstone");
  
          m.getTranslator("smart");
          control.setReturnValue(new NullTranslator());
  
          control.replay();
  
          p.process(elements, m);
  
          control.verify();
  
          List l = p.getElements();
  
          assertEquals(1, l.size());
          StringHolder h = (StringHolder) l.get(0);
  
          assertEquals("flintstone", h.getValue());
      }
  
        public void testGetContentTranslatorUnspecified()
        {
                ElementModelImpl em = new ElementModelImpl();
  
                em.setElementName("fred");
                // No content handler specified
  
                em.addRule(new 
CreateObjectRule(StringHolderImpl.class.getName()));
  
                ReadContentRule rule = new ReadContentRule();
                rule.setPropertyName("value");
  
                em.addRule(rule);
  
                em.addRule(new InvokeParentRule("addElement"));
  
                SchemaImpl schema = new SchemaImpl();
                schema.addElementModel(em);
  
                SchemaProcessorImpl p = new SchemaProcessorImpl(schema);
  
                ElementImpl element = new ElementImpl();
                element.setElementName("fred");
                element.setContent("flintstone");
  
                List elements = Collections.singletonList(element);
  
                MockControl control = 
MockControl.createStrictControl(Module.class);
                Module m = (Module) control.getMock();
  
                m.getClassResolver();
                control.setReturnValue(new DefaultClassResolver());
  
                m.expandSymbols("flintstone", null);
                control.setReturnValue("flintstone");
  
                control.replay();
  
                p.process(elements, m);
  
                control.verify();
  
                List l = p.getElements();
  
                assertEquals(1, l.size());
                StringHolder h = (StringHolder) l.get(0);
  
                assertEquals("flintstone", h.getValue());
        }
  
      public void testGetAttributeTranslator()
      {
          ElementModelImpl em = new ElementModelImpl();
  
          AttributeModelImpl am = new AttributeModelImpl();
          am.setName("wife");
          am.setTranslator("service");
  
          em.setElementName("fred");
          em.addAttributeModel(am);
  
          em.addRule(new CreateObjectRule(StringHolderImpl.class.getName()));
  
          ReadAttributeRule rule = new ReadAttributeRule();
          rule.setPropertyName("value");
          rule.setAttributeName("wife");
  
          em.addRule(rule);
  
          em.addRule(new InvokeParentRule("addElement"));
  
          SchemaImpl schema = new SchemaImpl();
          schema.addElementModel(em);
  
          SchemaProcessorImpl p = new SchemaProcessorImpl(schema);
  
          ElementImpl element = new ElementImpl();
          element.setElementName("fred");
          element.addAttribute(new AttributeImpl("wife", "wilma"));
  
          List elements = Collections.singletonList(element);
  
          MockControl control = MockControl.createStrictControl(Module.class);
          Module m = (Module) control.getMock();
  
          m.getClassResolver();
          control.setReturnValue(new DefaultClassResolver());
  
          m.expandSymbols("wilma", null);
          control.setReturnValue("wilma");
  
          m.getTranslator("service");
          control.setReturnValue(new NullTranslator());
  
          control.replay();
  
          p.process(elements, m);
  
          control.verify();
  
          List l = p.getElements();
  
          assertEquals(1, l.size());
          StringHolder h = (StringHolder) l.get(0);
  
          assertEquals("wilma", h.getValue());
      }
  }
  
  
  
  1.29      +14 -2     jakarta-hivemind/src/xsl/hivemind.xsl
  
  Index: hivemind.xsl
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/src/xsl/hivemind.xsl,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- hivemind.xsl      17 May 2004 16:57:48 -0000      1.28
  +++ hivemind.xsl      19 May 2004 15:08:49 -0000      1.29
  @@ -407,7 +407,9 @@
                                </xsl:if>
        
                                
  -                             <xsl:apply-templates/>
  +                             <xsl:apply-templates select="element">
  +                                     <xsl:sort select="@name"/>
  +                             </xsl:apply-templates>
                                
                        </tbody>                
                        </table>
  @@ -498,6 +500,16 @@
                        </xsl:choose>
                </td>
        </tr>   
  +     
  +     <xsl:if test="@translator">
  +     
  +             <tr>
  +                     <td/>
  +                     <th>Translator</th>
  +                     <td><xsl:value-of select="@translator"/></td>
  +             </tr>   
  +     </xsl:if>
  +     
                
                        <xsl:if test="description">
                                        <tr>
  
  
  

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

Reply via email to