hlship      2004/06/15 06:42:34

  Modified:    framework/src/java/org/apache/hivemind/util
                        ClassAdaptor.java PropertyUtils.java
                        PropertyAdaptor.java UtilMessages.java
                        UtilStrings.properties
               library/src/java/org/apache/hivemind/lib BeanFactory.java
               library/src/descriptor/META-INF hivemodule.sdl
               library/src/documentation/content/xdocs/hivemind-lib
                        PipelineFactory.xml BeanFactoryBuilder.xml
               library/src/java/org/apache/hivemind/lib/factory
                        FactoryStrings.properties FactoryMessages.java
               framework/src/java/org/apache/hivemind/schema/rules
                        ReadAttributeRule.java ReadContentRule.java
                        RuleUtils.java SetPropertyRule.java
               framework/src/test/org/apache/hivemind/util
                        TestPropertyUtils.java
               framework/src/java/org/apache/hivemind/service/impl
                        BuilderFactory.java
               framework/src/test/hivemind/test/services TestClassFab.java
                        TestServices.java
               framework/src/java/org/apache/hivemind/parse
                        DescriptorParser.java
               src/documentation/content/xdocs rules.xml links.ent
               framework/src/java/org/apache/hivemind/impl
                        MessageFormatter.java
  Added:       library/src/java/org/apache/hivemind/lib/factory
                        BeanTranslator.java
               library/src/test/org/apache/hivemind/lib/factory
                        TestBeanTranslator.java
  Log:
  Add BeanTranslator
  Add support for contributing beans as filters and terminators to a pipeline.
  
  Revision  Changes    Path
  1.4       +11 -20    
jakarta-hivemind/framework/src/java/org/apache/hivemind/util/ClassAdaptor.java
  
  Index: ClassAdaptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/util/ClassAdaptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ClassAdaptor.java 5 Jun 2004 19:09:12 -0000       1.3
  +++ ClassAdaptor.java 15 Jun 2004 13:42:33 -0000      1.4
  @@ -19,7 +19,6 @@
   import java.util.Map;
   
   import org.apache.hivemind.ApplicationRuntimeException;
  -import org.apache.hivemind.HiveMind;
   
   /**
    * Provides access to an object (of a particular class) as a set of 
individual property
  @@ -54,14 +53,12 @@
        * 
        * @param target the object to update
        * @param value the value to be stored into the target object property
  -     * @param location an object used to "locate" any errors, it will be 
passed to
  -     * [EMAIL PROTECTED] HiveMind#getLocationString(Object)} as part of any 
errors
        */
  -    public void write(Object target, String propertyName, Object value, 
Object location)
  +    public void write(Object target, String propertyName, Object value)
       {
  -        PropertyAdaptor a = getAdaptor(target, propertyName, location);
  +        PropertyAdaptor a = getAdaptor(target, propertyName);
   
  -        a.write(target, value, location);
  +        a.write(target, value);
       }
   
       /**
  @@ -69,15 +66,12 @@
        * 
        * @param target the object to read
        * @param propertyName the name of the property to read
  -     * @param location an object used to "locate" any errors, it will be 
passed to
  -     * [EMAIL PROTECTED] HiveMind#getLocationString(Object)} as part of any 
errors
  -     * @return the value for the named property
        */
  -    public Object read(Object target, String propertyName, Object location)
  +    public Object read(Object target, String propertyName)
       {
  -        PropertyAdaptor a = getAdaptor(target, propertyName, location);
  +        PropertyAdaptor a = getAdaptor(target, propertyName);
   
  -        return a.read(target, location);
  +        return a.read(target);
       }
   
       /**
  @@ -85,26 +79,23 @@
        * 
        * @param target the object to examine
        * @param propertyName the name of the property to check
  -     * @param location an object used to "locate" any errors, it will be 
passed to
  -     * [EMAIL PROTECTED] HiveMind#getLocationString(Object)} as part of any 
errors
  -     * @return the type of the named property
        */
  -    public Class getPropertyType(Object target, String propertyName, Object 
location)
  +    public Class getPropertyType(Object target, String propertyName)
       {
  -        PropertyAdaptor a = getAdaptor(target, propertyName, location);
  +        PropertyAdaptor a = getAdaptor(target, propertyName);
   
           return a.getPropertyType();
       }
   
  -    private PropertyAdaptor getAdaptor(Object target, String propertyName, 
Object location)
  +    private PropertyAdaptor getAdaptor(Object target, String propertyName)
       {
           PropertyAdaptor result = (PropertyAdaptor) 
_propertyAdaptorMap.get(propertyName);
   
           if (result == null)
               throw new ApplicationRuntimeException(
  -                UtilMessages.noSuchProperty(target, propertyName, location),
  +                UtilMessages.noSuchProperty(target, propertyName),
                   target,
  -                HiveMind.getLocation(location),
  +                null,
                   null);
   
           return result;
  
  
  
  1.4       +15 -31    
jakarta-hivemind/framework/src/java/org/apache/hivemind/util/PropertyUtils.java
  
  Index: PropertyUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/util/PropertyUtils.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PropertyUtils.java        5 Jun 2004 19:09:12 -0000       1.3
  +++ PropertyUtils.java        15 Jun 2004 13:42:33 -0000      1.4
  @@ -19,7 +19,6 @@
   import java.util.Map;
   
   import org.apache.hivemind.ApplicationRuntimeException;
  -import org.apache.hivemind.HiveMind;
   
   /**
    * A collection of static methods used to perform property-level access on 
arbitrary objects.
  @@ -41,14 +40,12 @@
        * @param target the object to update
        * @param propertyName the name of the property to be updated
        * @param value the value to be stored into the target object property
  -     * @param location an object used to "locate" any errors, it will be 
passed to
  -     * [EMAIL PROTECTED] HiveMind#getLocationString(Object)} as part of any 
errors
        */
  -    public static void write(Object target, String propertyName, Object 
value, Object location)
  +    public static void write(Object target, String propertyName, Object 
value)
       {
  -        ClassAdaptor a = getAdaptor(target, location);
  +        ClassAdaptor a = getAdaptor(target);
   
  -        a.write(target, propertyName, value, location);
  +        a.write(target, propertyName, value);
       }
   
       /**
  @@ -56,16 +53,13 @@
        * 
        * @param target the object to update
        * @param propertyName the name of a property toread
  -     * @param location an object used to "locate" any errors, it will be 
passed to
  -     * [EMAIL PROTECTED] HiveMind#getLocationString(Object)} as part of any 
errors
  -     * @return the value for the named property
        */
   
  -    public static Object read(Object target, String propertyName, Object 
location)
  +    public static Object read(Object target, String propertyName)
       {
  -        ClassAdaptor a = getAdaptor(target, location);
  +        ClassAdaptor a = getAdaptor(target);
   
  -        return a.read(target, propertyName, location);
  +        return a.read(target, propertyName);
       }
   
       /**
  @@ -73,25 +67,18 @@
        * 
        * @param target the object to examine
        * @param propertyName the name of the property to check
  -     * @param location an object used to "locate" any errors, it will be 
passed to
  -     * [EMAIL PROTECTED] HiveMind#getLocationString(Object)} as part of any 
errors
  -     * @return the type of the named property
        */
  -    public static Class getPropertyType(Object target, String propertyName, 
Object location)
  +    public static Class getPropertyType(Object target, String propertyName)
       {
  -        ClassAdaptor a = getAdaptor(target, location);
  +        ClassAdaptor a = getAdaptor(target);
   
  -        return a.getPropertyType(target, propertyName, location);
  +        return a.getPropertyType(target, propertyName);
       }
   
  -    private static synchronized ClassAdaptor getAdaptor(Object target, 
Object location)
  +    private static synchronized ClassAdaptor getAdaptor(Object target)
       {
           if (target == null)
  -            throw new ApplicationRuntimeException(
  -                UtilMessages.nullObject(location),
  -                null,
  -                HiveMind.getLocation(location),
  -                null);
  +            throw new ApplicationRuntimeException(UtilMessages.nullObject());
   
           Class targetClass = target.getClass();
   
  @@ -99,17 +86,14 @@
   
           if (result == null)
           {
  -            result = buildClassAdaptor(target, targetClass, location);
  +            result = buildClassAdaptor(target, targetClass);
               _classAdaptors.put(targetClass, result);
           }
   
           return result;
       }
   
  -    private static ClassAdaptor buildClassAdaptor(
  -        Object target,
  -        Class targetClass,
  -        Object location)
  +    private static ClassAdaptor buildClassAdaptor(Object target, Class 
targetClass)
       {
           try
           {
  @@ -120,9 +104,9 @@
           catch (Exception ex)
           {
               throw new ApplicationRuntimeException(
  -                UtilMessages.unableToIntrospect(targetClass, location, ex),
  +                UtilMessages.unableToIntrospect(targetClass, ex),
                   target,
  -                HiveMind.getLocation(location),
  +                null,
                   ex);
           }
       }
  
  
  
  1.4       +10 -16    
jakarta-hivemind/framework/src/java/org/apache/hivemind/util/PropertyAdaptor.java
  
  Index: PropertyAdaptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/util/PropertyAdaptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PropertyAdaptor.java      5 Jun 2004 19:09:12 -0000       1.3
  +++ PropertyAdaptor.java      15 Jun 2004 13:42:33 -0000      1.4
  @@ -17,7 +17,6 @@
   import java.lang.reflect.Method;
   
   import org.apache.hivemind.ApplicationRuntimeException;
  -import org.apache.hivemind.HiveMind;
   
   /**
    * Used to manage dynamic access to a property of a specific class.
  @@ -50,16 +49,14 @@
        * 
        * @param target the object to update
        * @param value the value to be stored into the target object property
  -     * @param location an object used to "locate" any errors, it will be 
passed to
  -     * [EMAIL PROTECTED] HiveMind#getLocationString(Object)} as part of any 
errors
        */
  -    public void write(Object target, Object value, Object location)
  +    public void write(Object target, Object value)
       {
           if (_writeMethod == null)
               throw new ApplicationRuntimeException(
  -                UtilMessages.noPropertyWriter(_propertyName, target, 
location),
  +                UtilMessages.noPropertyWriter(_propertyName, target),
                   target,
  -                HiveMind.getLocation(location),
  +                null,
                   null);
   
           try
  @@ -70,9 +67,9 @@
           catch (Exception ex)
           {
               throw new ApplicationRuntimeException(
  -                UtilMessages.writeFailure(_propertyName, target, location, 
ex),
  +                UtilMessages.writeFailure(_propertyName, target, ex),
                   target,
  -                HiveMind.getLocation(location),
  +                null,
                   ex);
           }
       }
  @@ -81,17 +78,14 @@
        * Reads the property of the target object.
        * 
        * @param target the object to read a property from
  -     * @param location an object used to "locate" any errors, it will be 
passed to
  -     * [EMAIL PROTECTED] HiveMind#getLocationString(Object)} as part of any 
errors
  -     * @return the value of the property
        */
  -    public Object read(Object target, Object location)
  +    public Object read(Object target)
       {
           if (_readMethod == null)
               throw new ApplicationRuntimeException(
  -                UtilMessages.noReader(_propertyName, target, location),
  +                UtilMessages.noReader(_propertyName, target),
                   target,
  -                HiveMind.getLocation(location),
  +                null,
                   null);
   
           try
  @@ -102,9 +96,9 @@
           catch (Exception ex)
           {
               throw new ApplicationRuntimeException(
  -                UtilMessages.readFailure(_propertyName, target, location, 
ex),
  +                UtilMessages.readFailure(_propertyName, target, ex),
                   target,
  -                HiveMind.getLocation(location),
  +                null,
                   ex);
           }
       }
  
  
  
  1.3       +15 -42    
jakarta-hivemind/framework/src/java/org/apache/hivemind/util/UtilMessages.java
  
  Index: UtilMessages.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/util/UtilMessages.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UtilMessages.java 10 Jun 2004 13:29:30 -0000      1.2
  +++ UtilMessages.java 15 Jun 2004 13:42:33 -0000      1.3
  @@ -33,13 +33,9 @@
       private static final MessageFormatter _formatter =
           new MessageFormatter(LOG, UtilMessages.class, "UtilStrings");
   
  -    public static String noSuchProperty(Object target, String propertyName, 
Object location)
  +    public static String noSuchProperty(Object target, String propertyName)
       {
  -        return _formatter.format(
  -            "no-such-property",
  -            target.getClass().getName(),
  -            propertyName,
  -            HiveMind.getLocationString(location));
  +        return _formatter.format("no-such-property", 
target.getClass().getName(), propertyName);
       }
   
       public static String noMatchingConstructor(Class targetClass, Object 
location)
  @@ -59,65 +55,42 @@
               _formatter.extractMessage(cause));
       }
   
  -    public static String noPropertyWriter(String propertyName, Object 
target, Object location)
  +    public static String noPropertyWriter(String propertyName, Object target)
       {
  -        return _formatter.format(
  -            "no-writer",
  -            propertyName,
  -            target,
  -            HiveMind.getLocationString(location));
  +        return _formatter.format("no-writer", propertyName, target);
       }
   
  -    public static String writeFailure(
  -        String propertyName,
  -        Object target,
  -        Object location,
  -        Throwable cause)
  +    public static String writeFailure(String propertyName, Object target, 
Throwable cause)
       {
           return _formatter.format(
               "write-failure",
  -            new Object[] {
  -                propertyName,
  -                target,
  -                HiveMind.getLocationString(location),
  -                _formatter.extractMessage(cause)});
  +            new Object[] { propertyName, target, 
_formatter.extractMessage(cause)});
       }
   
  -    public static String noReader(String propertyName, Object target, Object 
location)
  +    public static String noReader(String propertyName, Object target)
       {
  -        return _formatter.format(
  -            "no-reader",
  -            propertyName,
  -            target,
  -            HiveMind.getLocationString(location));
  +        return _formatter.format("no-reader", propertyName, target);
       }
   
  -    public static String readFailure(
  -        String propertyName,
  -        Object target,
  -        Object location,
  -        Throwable cause)
  +    public static String readFailure(String propertyName, Object target, 
Throwable cause)
       {
           return _formatter.format(
               "read-failure",
  -            new Object[] {
  -                propertyName,
  -                target,
  -                HiveMind.getLocationString(location),
  -                _formatter.extractMessage(cause)});
  +            propertyName,
  +            target,
  +            _formatter.extractMessage(cause));
       }
   
  -    public static String nullObject(Object location)
  +    public static String nullObject()
       {
  -        return _formatter.format("null-object", 
HiveMind.getLocationString(location));
  +        return _formatter.getMessage("null-object");
       }
   
  -    public static String unableToIntrospect(Class targetClass, Object 
location, Throwable cause)
  +    public static String unableToIntrospect(Class targetClass, Throwable 
cause)
       {
           return _formatter.format(
               "unable-to-introspect",
               targetClass.getName(),
  -            HiveMind.getLocationString(location),
               _formatter.extractMessage(cause));
       }
   }
  
  
  
  1.2       +7 -7      
jakarta-hivemind/framework/src/java/org/apache/hivemind/util/UtilStrings.properties
  
  Index: UtilStrings.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/util/UtilStrings.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UtilStrings.properties    10 Jun 2004 13:29:30 -0000      1.1
  +++ UtilStrings.properties    15 Jun 2004 13:42:33 -0000      1.2
  @@ -13,12 +13,12 @@
   # See the License for the specific language governing permissions and
   # limitations under the License.
   
  -no-such-property=Class {0} does not contain a property named ''{1}'' (at 
{2}).
  +no-such-property=Class {0} does not contain a property named ''{1}''.
   no-matching-constructor=Unable to find a constructor for class {0}.
   invoke-failed=Failure invoking constructor for class {0} (at {1}): {2}
  -no-writer=Property {0} of object {1} is read-only (at {2}).
  -write-failure=Unable to update property {0} of object {1} (at {2}): {3}
  -no-reader=Property {0} of object {1} is write-only (at {2}).
  -read-failure=Unable to read property {0} of object {1} (at {2}): {3}
  -null-object=Attempt to read or update properties of null (at {0}).
  -unable-to-introspect=Unable to introspect properties of class {0} (at {1}): 
{2}
  +no-writer=Property {0} of object {1} is read-only.
  +write-failure=Unable to update property {0} of object {1}: {2}
  +no-reader=Property {0} of object {1} is write-only.
  +read-failure=Unable to read property {0} of object {1}: {2}
  +null-object=Attempt to read or update properties of null.
  +unable-to-introspect=Unable to introspect properties of class {0}: {1}
  
  
  
  1.2       +1 -1      
jakarta-hivemind/library/src/java/org/apache/hivemind/lib/BeanFactory.java
  
  Index: BeanFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/BeanFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BeanFactory.java  15 Jun 2004 00:45:59 -0000      1.1
  +++ BeanFactory.java  15 Jun 2004 13:42:33 -0000      1.2
  @@ -24,7 +24,7 @@
    * Beans may be cached or not.
    * 
    * <p>
  - * The <code>hivemind.lib.ObjectFactoryBuilder</code> service is used to 
create services
  + * The <code>hivemind.lib.BeanFactoryBuilder</code> service is used to 
create services
    * implementing this interface (driven from a configuration).
    *
    * @author Howard Lewis Ship
  
  
  
  1.11      +59 -0     
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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- hivemodule.sdl    15 Jun 2004 00:45:59 -0000      1.10
  +++ hivemodule.sdl    15 Jun 2004 13:42:33 -0000      1.11
  @@ -256,6 +256,11 @@
          }
        }
        
  +     contribution (configuration-id=hivemind.Translators)
  +     {
  +       translator (name=bean 
class=org.apache.hivemind.lib.factory.BeanTranslator)
  +     }
  +     
        service-point (id=DefaultImplementationBuilder 
interface=org.apache.hivemind.lib.DefaultImplementationBuilder)
        {
          description
  @@ -373,6 +378,7 @@
            {
              description { "A list of ids of other contributed filters that 
should precede this filter in the pipeline." }
            }
  +         
            attribute (name=after translator=id-list)
            {
              description { "A list of ids of other contributed filters that 
should follow this filter in the pipeline." }
  @@ -390,6 +396,36 @@
          
          } // element filter
          
  +       element (name=filter-bean)
  +       {
  +         description { "Defines a filter in terms of a bean from a 
BeanFactory." }
  +         
  +         attribute (name=name required=true translator=bean)
  +         {
  +           description { "The bean to act as filter, in the form 
'service-id:name[,initializer]'." }
  +         }
  +         
  +         attribute (name=before translator=id-list)
  +         {
  +           description { "A list of ids of other contributed filters that 
should precede this filter in the pipeline." }
  +         }
  +         
  +         attribute (name=after translator=id-list)
  +         {
  +           description { "A list of ids of other contributed filters that 
should follow this filter in the pipeline." }
  +         }
  +       
  +         rules
  +         {
  +           create-object 
(class=org.apache.hivemind.lib.pipeline.FilterContribution)
  +           read-attribute (attribute=before property=before)
  +           read-attribute (attribute=after property=after)
  +           read-attribute (attribute=name property=filter)
  +           read-attribute (attribute=name property=name 
translator=qualified-id)
  +           invoke-parent (method=addElement)
  +         }
  +       }  // element filter-bean
  +       
          element (name=filter-object)
          {
            description { "Defines a filter in terms of an object." }
  @@ -419,6 +455,8 @@
            }
          }  // element filter-object
          
  +
  +       
          element (name=terminator)
          {
            description
  @@ -434,6 +472,27 @@
            }
            
          }  // element terminator
  +
  +       element (name=terminator-bean)
  +       {
  +         description
  +         {
  +           "A bean, implementing the pipeline's service interface, invoked 
by the final filter in the pipeline."
  +         }
  +         
  +         attribute (name=name required=true translator=bean)
  +         {
  +           description
  +           {
  +             "The bean to obtain from a BeanFactory, in the form 
'service-id:name[,initializer]'."
  +           } 
  +         }
  +         
  +         conversion 
(class=org.apache.hivemind.lib.pipeline.TerminatorContribution)
  +         {
  +           map (attribute=name property=terminator)
  +         }
  +       }
   
          element (name=terminator-object)
          {
  
  
  
  1.2       +27 -11    
jakarta-hivemind/library/src/documentation/content/xdocs/hivemind-lib/PipelineFactory.xml
  
  Index: PipelineFactory.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/library/src/documentation/content/xdocs/hivemind-lib/PipelineFactory.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PipelineFactory.xml       9 Jun 2004 14:58:16 -0000       1.1
  +++ PipelineFactory.xml       15 Jun 2004 13:42:33 -0000      1.2
  @@ -34,9 +34,13 @@
         parameter, whose type matches the <em>service interface</em> has been 
         added. </p>
       <p> For example, a service interface for transforming a string: </p>
  -    <source><![CDATA[ package mypackage; public interface 
  -      StringTransformService { public String transform(String inputValue); 
}]]> 
  -      </source>
  +    <source><![CDATA[
  +package mypackage; 
  +
  +public interface StringTransformService
  +{
  +  public String transform(String inputValue); 
  +}]]> </source>
       <p> The corresponding filter interface: </p>
       <source><![CDATA[
   package mypackage;
  @@ -98,15 +102,20 @@
         <section>
           <title>filter</title>
           <source><![CDATA[
  -filter (service-id=... before=... after=...) 
  -   
  +filter (service-id=... before=... after=...)
   ]]> </source>
  -        <p>Contributes a filter as a service. The optional 
  -          <code>before</code> and <code>after</code> attributes are lists of 
  -          the ids of other filters in the pipeline, used to set the ordering 
of 
  -          the filters. They may be comma-seperated lists of filter ids (or 
  -          filter names), or simple <code>*</code> to indicate absolute 
  -          positioning. </p>
  +        <p>Contributes a filter as a service. The optional 
<code>before</code> 
  +          and <code>after</code> attributes are lists of the ids of other 
  +          filters in the pipeline, used to set the ordering of the filters. 
  +          They may be comma-seperated lists of filter ids (or filter names), 
or 
  +          simple <code>*</code> to indicate absolute positioning. </p>
  +      </section>
  +      <section>
  +        <title>filter-bean</title>
  +        <source><![CDATA[
  +filter-bean (name=... before=... after=...)]]></source>
  +        <p> Contributes a bean (from a &api.BeanFactory;). The name is 
  +          of the format <code>service-id:name[,initializer]</code> </p>
         </section>
         <section>
           <title>filter-object</title>
  @@ -126,6 +135,13 @@
             terminator may be specified, and the terminator service provided 
in 
             the factory parameters takes precendence over a terminator in the 
             configuration. </p>
  +      </section>
  +      <section>
  +        <title>terminator-bean</title>
  +        <source><![CDATA[
  +terminator-bean (name=...)]]></source>
  +        <p> Contributes a terminator as a bean from a 
  +          &api.BeanFactory; service. </p>
         </section>
         <section>
           <title>terminator-object</title>
  
  
  
  1.2       +7 -8      
jakarta-hivemind/library/src/documentation/content/xdocs/hivemind-lib/BeanFactoryBuilder.xml
  
  Index: BeanFactoryBuilder.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/library/src/documentation/content/xdocs/hivemind-lib/BeanFactoryBuilder.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BeanFactoryBuilder.xml    15 Jun 2004 00:45:59 -0000      1.1
  +++ BeanFactoryBuilder.xml    15 Jun 2004 13:42:33 -0000      1.2
  @@ -25,15 +25,14 @@
       <title>hivemind.lib.BeanFactoryBuilder Service</title>
     </header>
     <body>
  -    <p>The <link 
  -      href="&hivedoc;/service/hivemind.lib.BeanFactoryBuilder.html"> 
  -      BeanFactoryBuilder</link> services is used to construct an <link 
  -      href="&apiroot-lib;/BeanFactory.html">BeanFactory</link> instance. An 
  -      BeanFactory will <em>vend out</em> instances of classes. A logical 
name 
  -      is mapped to a particular Java class to be instantiated. </p>
  +    <p>The <link 
href="&hivedoc;/service/hivemind.lib.BeanFactoryBuilder.html"> 
  +      BeanFactoryBuilder</link> services is used to construct a 
  +      &api.BeanFactory; instance. An BeanFactory will <em>vend out</em> 
  +      instances of classes. A logical name is mapped to a particular Java 
class 
  +      to be instantiated. </p>
       <p> Client code can retrieve beans via the factory's <code>get()</code> 
  -      method. Beans may be retrieved simply by name, or the name and an 
  -      initializer may be specified, seperated by commas. The initializer is 
  +      method. Beans are retrieved using a <em>locator</em>, which consists 
of a 
  +      name and an optional initializer seperated by commas. The initializer 
is 
         provided to the bean via an alternate constructor that takes a single 
         string parameter. Initializers are used, typically, to initialize 
         properties of the bean, but the actual implementation is internal to 
the 
  
  
  
  1.2       +1 -0      
jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/FactoryStrings.properties
  
  Index: FactoryStrings.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/FactoryStrings.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FactoryStrings.properties 15 Jun 2004 00:33:59 -0000      1.1
  +++ FactoryStrings.properties 15 Jun 2004 13:42:33 -0000      1.2
  @@ -18,3 +18,4 @@
   dupe-contribution=Contribution ''{0}'' duplicates a previous contribution 
(at {1}) and has been ignored.
   unknown-contribution=No object factory contribution named ''{0}''.
   unable-to-instantiate=Unable to instantiate instance of class {0}: {1}
  +invalid-bean-translator-format=''{0}'' is not formatted correctly, it should 
be ''service-id:name[,initializer]''.
  \ No newline at end of file
  
  
  
  1.3       +5 -0      
jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/FactoryMessages.java
  
  Index: FactoryMessages.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/FactoryMessages.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FactoryMessages.java      15 Jun 2004 00:45:59 -0000      1.2
  +++ FactoryMessages.java      15 Jun 2004 13:42:33 -0000      1.3
  @@ -63,4 +63,9 @@
               objectClass.getName(),
               _formatter.extractMessage(cause));
       }
  +    
  +    public static String invalidBeanTranslatorFormat(String inputValue)
  +    {
  +     return _formatter.format("invalid-bean-translator-format", inputValue);
  +    }
   }
  
  
  
  1.1                  
jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/BeanTranslator.java
  
  Index: BeanTranslator.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.lib.factory;
  
  import org.apache.hivemind.ApplicationRuntimeException;
  import org.apache.hivemind.HiveMind;
  import org.apache.hivemind.internal.Module;
  import org.apache.hivemind.lib.BeanFactory;
  import org.apache.hivemind.schema.Translator;
  
  /**
   * A translator that references a named (or named and initialized) bean from 
a 
   * [EMAIL PROTECTED] org.apache.hivemind.lib.BeanFactory}.  The translator 
string is of the form:
   * <code>service-id:name[,initializer]</code>. That is, the text after the 
colon
   * is an initializer passed to [EMAIL PROTECTED] 
org.apache.hivemind.lib.BeanFactory#get(String)}.
   *
   * @author Howard Lewis Ship
   */
  public class BeanTranslator implements Translator
  {
      public Object translate(Module contributingModule, Class propertyType, 
String inputValue)
      {
          if (HiveMind.isBlank(inputValue))
              return null;
  
          int colonx = inputValue.indexOf(':');
  
          if (colonx < 0)
              throw new ApplicationRuntimeException(
                  FactoryMessages.invalidBeanTranslatorFormat(inputValue));
  
          String serviceId = inputValue.substring(0, colonx);
  
          if (serviceId.length() == 0)
              throw new ApplicationRuntimeException(
                  FactoryMessages.invalidBeanTranslatorFormat(inputValue));
  
          String locator = inputValue.substring(colonx + 1);
  
          if (locator.length() == 0)
              throw new ApplicationRuntimeException(
                  FactoryMessages.invalidBeanTranslatorFormat(inputValue));
  
          BeanFactory f = (BeanFactory) 
contributingModule.getService(serviceId, BeanFactory.class);
  
          return f.get(locator);
      }
  
  }
  
  
  
  1.1                  
jakarta-hivemind/library/src/test/org/apache/hivemind/lib/factory/TestBeanTranslator.java
  
  Index: TestBeanTranslator.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.lib.factory;
  
  import org.apache.hivemind.ApplicationRuntimeException;
  import org.apache.hivemind.internal.Module;
  import org.apache.hivemind.lib.BeanFactory;
  import org.apache.hivemind.schema.Translator;
  import org.apache.hivemind.test.HiveMindTestCase;
  import org.easymock.MockControl;
  
  /**
   * Tests for [EMAIL PROTECTED] 
org.apache.hivemind.lib.factory.BeanTranslator}.
   *
   * @author Howard Lewis Ship
   */
  public class TestBeanTranslator extends HiveMindTestCase
  {
      public void testNullInput()
      {
          Translator t = new BeanTranslator();
  
          assertNull(t.translate(null, null, null));
      }
  
      public void testNoServiceId()
      {
          Translator t = new BeanTranslator();
  
          try
          {
              t.translate(null, null, "foo");
              unreachable();
          }
          catch (ApplicationRuntimeException ex)
          {
              assertEquals(
                  "'foo' is not formatted correctly, it should be 
'service-id:name[,initializer]'.",
                  ex.getMessage());
          }
      }
  
      public void testNoLocator()
      {
          Translator t = new BeanTranslator();
  
          try
          {
              t.translate(null, null, "foo:");
              unreachable();
          }
          catch (ApplicationRuntimeException ex)
          {
              assertEquals(
                  "'foo:' is not formatted correctly, it should be 
'service-id:name[,initializer]'.",
                  ex.getMessage());
          }
      }
  
      public void testSuccess()
      {
          String result = "Obtained via BeanFactory.";
  
          MockControl factoryControl = 
MockControl.createStrictControl(BeanFactory.class);
          BeanFactory factory = (BeanFactory) factoryControl.getMock();
  
          MockControl moduleControl = 
MockControl.createStrictControl(Module.class);
          Module module = (Module) moduleControl.getMock();
  
          module.getService("factory", BeanFactory.class);
          moduleControl.setReturnValue(factory);
  
          factory.get("my-bean,initialized");
          factoryControl.setReturnValue(result);
  
          moduleControl.replay();
          factoryControl.replay();
  
          Translator t = new BeanTranslator();
  
          assertSame(result, t.translate(module, null, 
"factory:my-bean,initialized"));
  
          moduleControl.verify();
          factoryControl.verify();
      }
  }
  
  
  
  1.9       +8 -4      
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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ReadAttributeRule.java    9 Jun 2004 14:51:47 -0000       1.8
  +++ ReadAttributeRule.java    15 Jun 2004 13:42:33 -0000      1.9
  @@ -45,7 +45,11 @@
       {
       }
   
  -    public ReadAttributeRule(String attributeName, String propertyName, 
String translator, Location location)
  +    public ReadAttributeRule(
  +        String attributeName,
  +        String propertyName,
  +        String translator,
  +        Location location)
       {
           setLocation(location);
   
  @@ -72,11 +76,11 @@
                       ? processor.getAttributeTranslator(_attributeName)
                       : processor.getTranslator(_translator);
   
  -            Class propertyType = PropertyUtils.getPropertyType(target, 
_propertyName, this);
  +            Class propertyType = PropertyUtils.getPropertyType(target, 
_propertyName);
   
               Object finalValue = 
t.translate(processor.getContributingModule(), propertyType, value);
   
  -            PropertyUtils.write(target, _propertyName, finalValue, this);
  +            PropertyUtils.write(target, _propertyName, finalValue);
   
           }
           catch (Exception ex)
  
  
  
  1.7       +3 -3      
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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ReadContentRule.java      5 Jun 2004 19:09:12 -0000       1.6
  +++ ReadContentRule.java      15 Jun 2004 13:42:33 -0000      1.7
  @@ -51,11 +51,11 @@
   
               Object target = processor.peek();
   
  -            Class propertyType = PropertyUtils.getPropertyType(target, 
_propertyName, this);
  +            Class propertyType = PropertyUtils.getPropertyType(target, 
_propertyName);
   
               Object finalValue = 
t.translate(processor.getContributingModule(), propertyType, value);
   
  -            PropertyUtils.write(target, _propertyName, finalValue, this);
  +            PropertyUtils.write(target, _propertyName, finalValue);
           }
           catch (Exception ex)
           {
  
  
  
  1.10      +7 -2      
jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/RuleUtils.java
  
  Index: RuleUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/RuleUtils.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RuleUtils.java    10 Jun 2004 19:49:39 -0000      1.9
  +++ RuleUtils.java    15 Jun 2004 13:42:33 -0000      1.10
  @@ -128,7 +128,7 @@
       {
           try
           {
  -            PropertyUtils.write(target, propertyName, value, element);
  +            PropertyUtils.write(target, propertyName, value);
           }
           catch (Exception ex)
           {
  @@ -138,7 +138,12 @@
               ErrorHandler errorHandler = 
processor.getContributingModule().getErrorHandler();
               errorHandler.error(
                   LOG,
  -                RulesMessages.unableToSetElementProperty(propertyName, 
target, processor, element, ex),
  +                RulesMessages.unableToSetElementProperty(
  +                    propertyName,
  +                    target,
  +                    processor,
  +                    element,
  +                    ex),
                   element.getLocation(),
                   ex);
           }
  
  
  
  1.3       +2 -3      
jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/SetPropertyRule.java
  
  Index: SetPropertyRule.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/SetPropertyRule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SetPropertyRule.java      5 Jun 2004 19:09:12 -0000       1.2
  +++ SetPropertyRule.java      15 Jun 2004 13:42:33 -0000      1.3
  @@ -45,13 +45,12 @@
               if (_smartTranslator == null)
                   _smartTranslator = RuleUtils.getTranslator(processor, 
"smart");
   
  -            Class propertyType = PropertyUtils.getPropertyType(target, 
_propertyName, this);
  +            Class propertyType = PropertyUtils.getPropertyType(target, 
_propertyName);
   
               Object finalValue =
                   
_smartTranslator.translate(processor.getContributingModule(), propertyType, 
value);
   
  -            PropertyUtils.write(target, _propertyName, finalValue, this);
  -
  +            PropertyUtils.write(target, _propertyName, finalValue);
           }
           catch (Exception ex)
           {
  
  
  
  1.3       +17 -40    
jakarta-hivemind/framework/src/test/org/apache/hivemind/util/TestPropertyUtils.java
  
  Index: TestPropertyUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/org/apache/hivemind/util/TestPropertyUtils.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestPropertyUtils.java    10 Jun 2004 13:29:30 -0000      1.2
  +++ TestPropertyUtils.java    15 Jun 2004 13:42:33 -0000      1.3
  @@ -27,8 +27,6 @@
   import org.apache.hivemind.impl.DefaultClassResolver;
   import org.apache.hivemind.impl.LocationImpl;
   import org.apache.hivemind.test.HiveMindTestCase;
  -import org.apache.hivemind.util.ClasspathResource;
  -import org.apache.hivemind.util.PropertyUtils;
   
   /**
    * Tests for the [EMAIL PROTECTED] org.apache.hivemind.util.PropertyUtils} 
class.
  @@ -141,26 +139,25 @@
   
           b.setValue(37);
   
  -        assertEquals(new Integer(37), PropertyUtils.read(b, "value", null));
  +        assertEquals(new Integer(37), PropertyUtils.read(b, "value"));
       }
   
       public void testWrite()
       {
           Bean b = new Bean();
   
  -        PropertyUtils.write(b, "value", new Integer(412), null);
  +        PropertyUtils.write(b, "value", new Integer(412));
   
           assertEquals(412, b.getValue());
       }
   
       public void testMissingProperty()
       {
  -        Location l = makeLocation(19);
           Bean b = new Bean();
   
           try
           {
  -            PropertyUtils.read(b, "zaphod", l);
  +            PropertyUtils.read(b, "zaphod");
   
               unreachable();
           }
  @@ -168,134 +165,114 @@
           {
               assertEquals(
                   "Class org.apache.hivemind.util.TestPropertyUtils$Bean does 
not "
  -                    + "contain a property named 'zaphod' (at 
classpath:/foo/bar, line 19).",
  +                    + "contain a property named 'zaphod'.",
                   ex.getMessage());
               assertEquals(b, ex.getComponent());
  -            assertEquals(l, ex.getLocation());
           }
       }
   
       public void testReadOnly()
       {
  -        Location l = makeLocation(27);
           Bean b = new Bean();
   
           try
           {
  -            PropertyUtils.write(b, "class", null, l);
  +            PropertyUtils.write(b, "class", null);
               unreachable();
           }
           catch (ApplicationRuntimeException ex)
           {
               assertEquals(
  -                "Property class of object PropertyUtilsTestBean is "
  -                    + "read-only (at classpath:/foo/bar, line 27).",
  +                "Property class of object PropertyUtilsTestBean is 
read-only.",
                   ex.getMessage());
               assertEquals(b, ex.getComponent());
  -            assertEquals(l, ex.getLocation());
           }
       }
   
       public void testWriteOnly()
       {
  -        Location l = makeLocation(35);
           Bean b = new Bean();
   
           try
           {
  -            PropertyUtils.read(b, "writeOnly", l);
  +            PropertyUtils.read(b, "writeOnly");
               unreachable();
           }
           catch (ApplicationRuntimeException ex)
           {
               assertEquals(
  -                "Property writeOnly of object PropertyUtilsTestBean is 
write-only (at classpath:/foo/bar, line 35).",
  +                "Property writeOnly of object PropertyUtilsTestBean is 
write-only.",
                   ex.getMessage());
               assertEquals(b, ex.getComponent());
  -            assertEquals(l, ex.getLocation());
           }
       }
   
       public void testReadFailure()
       {
  -        Location l = makeLocation(17);
           ExceptionBean b = new ExceptionBean();
   
           try
           {
  -            PropertyUtils.read(b, "failure", l);
  +            PropertyUtils.read(b, "failure");
               unreachable();
           }
           catch (ApplicationRuntimeException ex)
           {
               assertEquals(
  -                "Unable to read property failure of object 
PropertyUtilsExceptionBean "
  -                    + "(at classpath:/foo/bar, line 17): 
java.lang.reflect.InvocationTargetException",
  +                "Unable to read property failure of object 
PropertyUtilsExceptionBean: java.lang.reflect.InvocationTargetException",
                   ex.getMessage());
               assertEquals(b, ex.getComponent());
  -            assertEquals(l, ex.getLocation());
           }
       }
   
       public void testWriteFailure()
       {
  -        Location l = makeLocation(17);
           ExceptionBean b = new ExceptionBean();
   
           try
           {
  -            PropertyUtils.write(b, "failure", Boolean.FALSE, l);
  +            PropertyUtils.write(b, "failure", Boolean.FALSE);
               unreachable();
           }
           catch (ApplicationRuntimeException ex)
           {
               assertEquals(
  -                "Unable to update property failure of object 
PropertyUtilsExceptionBean "
  -                    + "(at classpath:/foo/bar, line 17): 
java.lang.reflect.InvocationTargetException",
  +                "Unable to update property failure of object 
PropertyUtilsExceptionBean: java.lang.reflect.InvocationTargetException",
                   ex.getMessage());
               assertEquals(b, ex.getComponent());
  -            assertEquals(l, ex.getLocation());
           }
       }
   
       public void testIntrospectFailure()
       {
  -        Location l = makeLocation(212);
           UglyBean b = new UglyBean();
   
           try
           {
  -            PropertyUtils.read(b, "google", l);
  +            PropertyUtils.read(b, "google");
               unreachable();
           }
           catch (ApplicationRuntimeException ex)
           {
               assertEquals(
                   "Unable to introspect properties of class "
  -                    + "org.apache.hivemind.util.TestPropertyUtils$UglyBean "
  -                    + "(at classpath:/foo/bar, line 212): 
java.lang.NullPointerException",
  +                    + "org.apache.hivemind.util.TestPropertyUtils$UglyBean: 
java.lang.NullPointerException",
                   ex.getMessage());
               assertEquals(b, ex.getComponent());
  -            assertEquals(l, ex.getLocation());
           }
       }
   
       public void testNull()
       {
  -        Location l = makeLocation(63);
  -
           try
           {
  -            PropertyUtils.read(null, "fred", l);
  +            PropertyUtils.read(null, "fred");
               unreachable();
   
           }
           catch (ApplicationRuntimeException ex)
           {
  -            assertEquals(
  -                "Attempt to read or update properties of null (at 
classpath:/foo/bar, line 63).",
  -                ex.getMessage());
  -            assertEquals(l, ex.getLocation());
  +            assertEquals("Attempt to read or update properties of null.", 
ex.getMessage());
           }
       }
   
  @@ -303,6 +280,6 @@
       {
           Bean b = new Bean();
   
  -        assertEquals(int.class, PropertyUtils.getPropertyType(b, "value", 
null));
  +        assertEquals(int.class, PropertyUtils.getPropertyType(b, "value"));
       }
   }
  
  
  
  1.9       +14 -5     
jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderFactory.java
  
  Index: BuilderFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderFactory.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BuilderFactory.java       10 Jun 2004 19:49:39 -0000      1.8
  +++ BuilderFactory.java       15 Jun 2004 13:42:33 -0000      1.9
  @@ -19,8 +19,10 @@
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.ClassResolver;
   import org.apache.hivemind.HiveMind;
  +import org.apache.hivemind.Location;
   import org.apache.hivemind.ServiceImplementationFactory;
   import org.apache.hivemind.internal.Module;
   import org.apache.hivemind.service.EventLinker;
  @@ -105,21 +107,28 @@
               BuilderFacet facet = (BuilderFacet) properties.get(i);
               String propertyName = facet.getPropertyName();
   
  -            // There will be a facet for log, messages and service-id even 
if no
  +            // There will be a facet for log, messages, service-id, etc. 
even if no
               // property name is specified, so we skip it here.
   
               if (propertyName == null)
                   continue;
   
  -            Class targetType = PropertyUtils.getPropertyType(target, 
propertyName, facet);
  +            Class targetType = PropertyUtils.getPropertyType(target, 
propertyName);
   
               Object value = facet.getFacetValue(serviceId, invokingModule, 
targetType);
   
  -            HiveMind.setLocation(value, HiveMind.getLocation(facet));
  +            Location location = HiveMind.getLocation(facet);
   
  -            // Allow exceptions when setting properties to propogate up
  +            HiveMind.setLocation(value, location);
   
  -            PropertyUtils.write(target, propertyName, value, facet);
  +            try
  +            {
  +                PropertyUtils.write(target, propertyName, value);
  +            }
  +            catch (Exception ex)
  +            {
  +                throw new ApplicationRuntimeException(ex.getMessage(), 
target, location, ex);
  +            }
           }
       }
   
  
  
  
  1.3       +5 -5      
jakarta-hivemind/framework/src/test/hivemind/test/services/TestClassFab.java
  
  Index: TestClassFab.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/TestClassFab.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestClassFab.java 12 Jun 2004 18:43:41 -0000      1.2
  +++ TestClassFab.java 15 Jun 2004 13:42:33 -0000      1.3
  @@ -68,9 +68,9 @@
   
           Object targetBean = targetClass.newInstance();
   
  -        PropertyUtils.write(targetBean, "stringValue", "Fred", null);
  +        PropertyUtils.write(targetBean, "stringValue", "Fred");
   
  -        String actual = (String) PropertyUtils.read(targetBean, 
"stringValue", null);
  +        String actual = (String) PropertyUtils.read(targetBean, 
"stringValue");
   
           assertEquals("Fred", actual);
       }
  @@ -102,7 +102,7 @@
   
           Object targetBean = c.newInstance(new Object[] { "Buffy" });
   
  -        String actual = (String) PropertyUtils.read(targetBean, 
"stringValue", null);
  +        String actual = (String) PropertyUtils.read(targetBean, 
"stringValue");
   
           assertEquals("Buffy", actual);
       }
  @@ -233,7 +233,7 @@
   
           Object bean = cf.createClass().newInstance();
   
  -        assertEquals(new Integer(2), PropertyUtils.read(bean, "value", 
null));
  +        assertEquals(new Integer(2), PropertyUtils.read(bean, "value"));
       }
   
       public void testExtendMethodAlterReturn() throws Exception
  @@ -250,7 +250,7 @@
   
           Object bean = cf.createClass().newInstance();
   
  -        assertEquals(new Integer(6), PropertyUtils.read(bean, "value", 
null));
  +        assertEquals(new Integer(6), PropertyUtils.read(bean, "value"));
       }
   
       public void testExtendMethodFailure() throws Exception
  
  
  
  1.16      +2 -2      
jakarta-hivemind/framework/src/test/hivemind/test/services/TestServices.java
  
  Index: TestServices.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/TestServices.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TestServices.java 10 Jun 2004 13:29:30 -0000      1.15
  +++ TestServices.java 15 Jun 2004 13:42:33 -0000      1.16
  @@ -302,7 +302,7 @@
                   ex,
                   "Unable to construct service 
hivemind\\.test\\.services\\.BuilderAccessFailure: "
                       + "Class 
hivemind\\.test\\.services\\.impl\\.BuilderAccessImpl "
  -                    + "does not contain a property named 'EVIL' \\(at 
.*?\\)\\.");
  +                    + "does not contain a property named 'EVIL'\\.");
           }
       }
   
  
  
  
  1.18      +8 -1      
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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DescriptorParser.java     10 Jun 2004 19:49:40 -0000      1.17
  +++ DescriptorParser.java     15 Jun 2004 13:42:34 -0000      1.18
  @@ -109,7 +109,14 @@
                       _referenceLocation,
                       null);
   
  -            PropertyUtils.write(_container, _propertyName, s, 
_referenceLocation);
  +            try
  +            {
  +                PropertyUtils.write(_container, _propertyName, s);
  +            }
  +            catch (Exception ex)
  +            {
  +                _errorHandler.error(LOG, ex.getMessage(), 
_referenceLocation, ex);
  +            }
           }
       }
   
  
  
  
  1.4       +11 -0     
jakarta-hivemind/src/documentation/content/xdocs/rules.xml
  
  Index: rules.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/src/documentation/content/xdocs/rules.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- rules.xml 9 Jun 2004 14:58:16 -0000       1.3
  +++ rules.xml 15 Jun 2004 13:42:34 -0000      1.4
  @@ -317,6 +317,17 @@
         <p>The following sections describe the basic translators provided with 
           the framework. You can add additional translators by contributing to 
           the &hivemind.Translators; configuration point.</p>
  +        <section>
  +          <title>bean</title>
  +          <p>
  +            The bean translator expects its input to bean in the form
  +            <code>service-id:locator</code>. The service-id
  +            references a service implementing &api.BeanFactory;.
  +          </p>
  +          <note>
  +            This translator is contributed by the hivemind.lib module.
  +          </note>
  +        </section>
         <section>
           <title>boolean</title>
           <p>The boolean translator converts an input string into a boolean 
  
  
  
  1.8       +4 -1      
jakarta-hivemind/src/documentation/content/xdocs/links.ent
  
  Index: links.ent
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/src/documentation/content/xdocs/links.ent,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- links.ent 10 Jun 2004 19:49:40 -0000      1.7
  +++ links.ent 15 Jun 2004 13:42:34 -0000      1.8
  @@ -40,6 +40,9 @@
   <!ENTITY api.RemoteExceptionCoordinator '<link 
href="&apiroot;/lib/RemoteExceptionCoordinator.html">RemoteExceptionCoordinator</link>'>
   <!ENTITY api.RemoteExceptionListener '<link 
href="&apiroot;/lib/RemoteExceptionListener.html">RemoteExceptionListener</link>'>
   
  +
  +<!ENTITY api.BeanFactory '<link 
href="&apiroot-lib;/BeanFactory.html">BeanFactory</link>'>
  +
   <!ENTITY Spring '<link href="site:spring">Spring</link>'>
   
   <!-- Note, these links CAN NOT currently be converted to site:descriptor#foo 
because Forrest 0.5.1 doesn't
  
  
  
  1.4       +7 -0      
jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/MessageFormatter.java
  
  Index: MessageFormatter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/MessageFormatter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MessageFormatter.java     10 Jun 2004 19:49:39 -0000      1.3
  +++ MessageFormatter.java     15 Jun 2004 13:42:34 -0000      1.4
  @@ -94,6 +94,13 @@
           }
       }
   
  +     /**
  +      * Extracts the message from an exception. If the message is null, the 
the class name
  +      * of the exception is returned.
  +      * 
  +      * <p>
  +      * Note: probably should be a static method!
  +      */
       public String extractMessage(Throwable t)
       {
           if (t == null)
  
  
  

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

Reply via email to