hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-hivemind/hivebuild forrestdoc.xml
Date Sun, 31 Oct 2004 14:44:25 GMT
hlship      2004/10/31 06:44:25

  Modified:    framework/src/java/org/apache/hivemind/util
                        PropertyUtils.java
               framework/src/java/org/apache/hivemind/service/impl
                        EventLinkerImpl.java BuilderFactoryLogic.java
               framework/src/java/org/apache/hivemind HiveMind.java
               .        status.xml
               framework/src/java/org/apache/hivemind/impl
                        RegistryInfrastructureImpl.java
               hivebuild forrestdoc.xml
  Log:
  HIVEMIND-68: Properly report the actual method name when invoking a service initializer
method.
  
  Revision  Changes    Path
  1.9       +49 -35    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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PropertyUtils.java	13 Sep 2004 14:48:16 -0000	1.8
  +++ PropertyUtils.java	31 Oct 2004 14:44:25 -0000	1.9
  @@ -13,6 +13,7 @@
   // limitations under the License.
   
   package org.apache.hivemind.util;
  +
   import java.beans.BeanInfo;
   import java.beans.Introspector;
   import java.util.HashMap;
  @@ -20,10 +21,11 @@
   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.
  - *
  + * 
    * @author Howard Lewis Ship
    */
   public class PropertyUtils
  @@ -38,9 +40,12 @@
       /**
        * Updates the property of the target object.
        * 
  -     * @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 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
        */
       public static void write(Object target, String propertyName, Object value)
       {
  @@ -52,8 +57,10 @@
       /**
        * Returns true of the instance contains a writable property of the given type.
        * 
  -     * @param target the object to inspect
  -     * @param propertyName the name of the property to check
  +     * @param target
  +     *            the object to inspect
  +     * @param propertyName
  +     *            the name of the property to check
        */
   
       public static boolean isWritable(Object target, String propertyName)
  @@ -69,8 +76,10 @@
       /**
        * Updates the property of the target object.
        * 
  -     * @param target the object to update
  -     * @param propertyName the name of a property toread
  +     * @param target
  +     *            the object to update
  +     * @param propertyName
  +     *            the name of a property toread
        */
   
       public static Object read(Object target, String propertyName)
  @@ -83,8 +92,10 @@
       /**
        * Returns the type of the named property.
        * 
  -     * @param target the object to examine
  -     * @param propertyName the name of the property to check
  +     * @param target
  +     *            the object to examine
  +     * @param propertyName
  +     *            the name of the property to check
        */
       public static Class getPropertyType(Object target, String propertyName)
       {
  @@ -94,9 +105,10 @@
       }
   
       /**
  -     * Returns the {@link PropertyAdaptor} for the given target object and property name.
  +     * Returns the {@link PropertyAdaptor}for the given target object and property name.
        * 
  -     * @throws ApplicationRuntimeException if the property does not exist.
  +     * @throws ApplicationRuntimeException
  +     *             if the property does not exist.
        */
       public static PropertyAdaptor getPropertyAdaptor(Object target, String propertyName)
       {
  @@ -106,8 +118,7 @@
       }
   
       /**
  -     * Returns an unordered List of the names of all readable properties
  -     * of the target.
  +     * Returns an unordered List of the names of all readable properties of the target.
        */
       public static List getReadableProperties(Object target)
       {
  @@ -115,30 +126,32 @@
       }
   
       /**
  -     * Returns an unordered List of the names of all writable properties
  -     * of the target.
  +     * Returns an unordered List of the names of all writable properties of the target.
        */
       public static List getWriteableProperties(Object target)
       {
           return getAdaptor(target).getWriteableProperties();
       }
   
  -    private static synchronized ClassAdaptor getAdaptor(Object target)
  +    private static ClassAdaptor getAdaptor(Object target)
       {
           if (target == null)
               throw new ApplicationRuntimeException(UtilMessages.nullObject());
   
           Class targetClass = target.getClass();
   
  -        ClassAdaptor result = (ClassAdaptor) _classAdaptors.get(targetClass);
  -
  -        if (result == null)
  +        synchronized (HiveMind.INTROSPECTOR_MUTEX)
           {
  -            result = buildClassAdaptor(target, targetClass);
  -            _classAdaptors.put(targetClass, result);
  -        }
  +            ClassAdaptor result = (ClassAdaptor) _classAdaptors.get(targetClass);
   
  -        return result;
  +            if (result == null)
  +            {
  +                result = buildClassAdaptor(target, targetClass);
  +                _classAdaptors.put(targetClass, result);
  +            }
  +
  +            return result;
  +        }
       }
   
       private static ClassAdaptor buildClassAdaptor(Object target, Class targetClass)
  @@ -151,20 +164,21 @@
           }
           catch (Exception ex)
           {
  -            throw new ApplicationRuntimeException(
  -                UtilMessages.unableToIntrospect(targetClass, ex),
  -                target,
  -                null,
  -                ex);
  +            throw new ApplicationRuntimeException(UtilMessages.unableToIntrospect(targetClass,
ex),
  +                    target, null, ex);
           }
       }
   
  -	/**
  -	 * Clears all cached information.
  -	 */
  -    public static synchronized void clearCache()
  +    /**
  +     * Clears all cached information. Invokes {@link Introspector#flushCaches()}.
  +     */
  +    public static void clearCache()
       {
  -        _classAdaptors.clear();
  +        synchronized (HiveMind.INTROSPECTOR_MUTEX)
  +        {
  +            _classAdaptors.clear();
  +            Introspector.flushCaches();
  +        }
       }
   
  -}
  +}
  \ No newline at end of file
  
  
  
  1.7       +44 -49    jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/EventLinkerImpl.java
  
  Index: EventLinkerImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/EventLinkerImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- EventLinkerImpl.java	29 Jul 2004 13:18:52 -0000	1.6
  +++ EventLinkerImpl.java	31 Oct 2004 14:44:25 -0000	1.7
  @@ -30,15 +30,16 @@
   import org.apache.hivemind.service.EventLinker;
   
   /**
  - * Implementation of {@link org.apache.hivemind.service.EventLinker}. Will output warnings
  - * whenever a consumer can't be registered for at least one event set (which can happen
  - * when the consumer does not implement the necessary interfaces).
  - *
  + * Implementation of {@link org.apache.hivemind.service.EventLinker}. Will output warnings
whenever
  + * a consumer can't be registered for at least one event set (which can happen when the
consumer
  + * does not implement the necessary interfaces).
  + * 
    * @author Howard Lewis Ship
    */
   public class EventLinkerImpl extends BaseLocatable implements EventLinker
   {
       private Log _log;
  +
       private ErrorHandler _errorHandler;
   
       /**
  @@ -52,11 +53,8 @@
           _errorHandler = errorHandler;
       }
   
  -    public void addEventListener(
  -        Object producer,
  -        String eventSetName,
  -        Object consumer,
  -        Location location)
  +    public void addEventListener(Object producer, String eventSetName, Object consumer,
  +            Location location)
       {
           EventSetDescriptor[] sets = getEventSets(producer);
           boolean nameMatch = HiveMind.isNonBlank(eventSetName);
  @@ -77,11 +75,10 @@
                       addEventListener(producer, set, consumer, location);
                   else
                   {
  -                    _errorHandler.error(
  -                        _log,
  -                        ServiceMessages.notCompatibleWithEvent(consumer, set, producer),
  -                        location,
  -                        null);
  +                    _errorHandler.error(_log, ServiceMessages.notCompatibleWithEvent(
  +                            consumer,
  +                            set,
  +                            producer), location, null);
                   }
   
                   return;
  @@ -100,16 +97,16 @@
           {
               if (nameMatch)
                   _errorHandler.error(
  -                    _log,
  -                    ServiceMessages.noSuchEventSet(producer, eventSetName),
  -                    location,
  -                    null);
  +                        _log,
  +                        ServiceMessages.noSuchEventSet(producer, eventSetName),
  +                        location,
  +                        null);
               else
                   _errorHandler.error(
  -                    _log,
  -                    ServiceMessages.noEventMatches(consumer, producer),
  -                    location,
  -                    null);
  +                        _log,
  +                        ServiceMessages.noEventMatches(consumer, producer),
  +                        location,
  +                        null);
           }
       }
   
  @@ -118,25 +115,24 @@
           return set.getListenerType().isAssignableFrom(consumerClass);
       }
   
  -    private void addEventListener(
  -        Object producer,
  -        EventSetDescriptor set,
  -        Object consumer,
  -        Location location)
  +    private void addEventListener(Object producer, EventSetDescriptor set, Object consumer,
  +            Location location)
       {
           Method m = set.getAddListenerMethod();
   
           try
           {
  -            m.invoke(producer, new Object[] { consumer });
  +            m.invoke(producer, new Object[]
  +            { consumer });
           }
           catch (Exception ex)
           {
  -            _errorHandler.error(
  -                _log,
  -                ServiceMessages.unableToAddListener(producer, set, consumer, location,
ex),
  -                location,
  -                ex);
  +            _errorHandler.error(_log, ServiceMessages.unableToAddListener(
  +                    producer,
  +                    set,
  +                    consumer,
  +                    location,
  +                    ex), location, ex);
   
           }
       }
  @@ -167,26 +163,25 @@
   
       private EventSetDescriptor[] findEventSets(Class producerClass)
       {
  -        try
  +        synchronized (HiveMind.INTROSPECTOR_MUTEX)
           {
  -            BeanInfo beanInfo = Introspector.getBeanInfo(producerClass);
  +            try
  +            {
  +                BeanInfo beanInfo = Introspector.getBeanInfo(producerClass);
   
  -            // Will return an empty array (not null) when the class contains
  -            // no event sets.
  +                // Will return an empty array (not null) when the class contains
  +                // no event sets.
   
  -            return beanInfo.getEventSetDescriptors();
  -        }
  -        catch (IntrospectionException ex)
  -        {
  -            _errorHandler.error(
  -                _log,
  -                ServiceMessages.unableToIntrospectClass(producerClass, ex),
  -                null,
  -                ex);
  +                return beanInfo.getEventSetDescriptors();
  +            }
  +            catch (IntrospectionException ex)
  +            {
  +                _errorHandler.error(_log, ServiceMessages
  +                        .unableToIntrospectClass(producerClass, ex), null, ex);
   
  -            return new EventSetDescriptor[0];
  +                return new EventSetDescriptor[0];
  +            }
           }
  -
       }
   
  -}
  +}
  \ No newline at end of file
  
  
  
  1.5       +1 -1      jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderFactoryLogic.java
  
  Index: BuilderFactoryLogic.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderFactoryLogic.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BuilderFactoryLogic.java	19 Jul 2004 14:07:36 -0000	1.4
  +++ BuilderFactoryLogic.java	31 Oct 2004 14:44:25 -0000	1.5
  @@ -142,7 +142,7 @@
                   _log,
                   ServiceMessages.unableToInitializeService(
                       _serviceId,
  -                    methodName,
  +                    searchMethodName,
                       service.getClass(),
                       ex),
                   _parameter.getLocation(),
  
  
  
  1.13      +28 -24    jakarta-hivemind/framework/src/java/org/apache/hivemind/HiveMind.java
  
  Index: HiveMind.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/HiveMind.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- HiveMind.java	18 Aug 2004 23:20:11 -0000	1.12
  +++ HiveMind.java	31 Oct 2004 14:44:25 -0000	1.13
  @@ -18,17 +18,25 @@
   
   /**
    * Static utility class for HiveMind.
  - *
  + * 
    * @author Howard Lewis Ship
    */
   public final class HiveMind
   {
       /**
  -     * The full id of the {@link org.apache.hivemind.service.ThreadEventNotifier}
  -     * service.
  +     * The full id of the {@link org.apache.hivemind.service.ThreadEventNotifier}service.
        */
       public static final String THREAD_EVENT_NOTIFIER_SERVICE = "hivemind.ThreadEventNotifier";
   
  +    /**
  +     * An object used to synchronize access to {@link java.beans.Introspector}(which is
not fully
  +     * threadsafe).
  +     * 
  +     * @since 3.1
  +     */
  +
  +    public static final Object INTROSPECTOR_MUTEX = new Object();
  +
       private HiveMind()
       {
           // Prevent instantiation
  @@ -40,10 +48,8 @@
       }
   
       /**
  -     * Selects the first {@link Location} in an array of objects.
  -     * Skips over nulls.  The objects may be instances of
  -     * Location or {@link Locatable}.  May return null
  -     * if no Location can be found. 
  +     * Selects the first {@link Location}in an array of objects. Skips over nulls. The
objects may
  +     * be instances of Location or {@link Locatable}. May return null if no Location can
be found.
        */
   
       public static Location findLocation(Object[] locations)
  @@ -63,8 +69,8 @@
       }
   
       /**
  -     * Extracts a location from an object, checking to see if it
  -     * implement {@link Location} or {@link Locatable}.
  +     * Extracts a location from an object, checking to see if it implement {@link Location}or
  +     * {@link Locatable}.
        * 
        * @returns the Location, or null if it can't be found
        */
  @@ -87,9 +93,8 @@
       }
   
       /**
  -     * Invokes {@link #getLocation(Object)}, then translate the result
  -     * to a string value, or "unknown location" if null.
  -     * 
  +     * Invokes {@link #getLocation(Object)}, then translate the result to a string value,
or
  +     * "unknown location" if null.
        */
       public static String getLocationString(Object object)
       {
  @@ -103,10 +108,9 @@
   
       /**
        * Returns true if the string is null, empty, or contains only whitespace.
  -     * 
        * <p>
  -     * The commons-lang library provides a version of this, but the naming and behavior
  -     * changed between 1.0 and 2.0, which causes some dependency issues.
  +     * The commons-lang library provides a version of this, but the naming and behavior
changed
  +     * between 1.0 and 2.0, which causes some dependency issues.
        */
       public static boolean isBlank(String string)
       {
  @@ -128,11 +132,12 @@
       }
   
       /**
  -     * Updates the location of an object, if the object implements
  -     * {@link LocationHolder}.
  +     * Updates the location of an object, if the object implements {@link LocationHolder}.
        * 
  -     * @param holder the object to be updated
  -     * @param location the location to assign to the holder object
  +     * @param holder
  +     *            the object to be updated
  +     * @param location
  +     *            the location to assign to the holder object
        */
       public static void setLocation(Object holder, Location location)
       {
  @@ -145,15 +150,14 @@
       }
   
       /**
  -     * Checks if the value (a constructor or method parameter) is null,
  -     * and throws an InvalidArgumentException if so.
  +     * Checks if the value (a constructor or method parameter) is null, and throws an
  +     * InvalidArgumentException if so.
        */
   
       public static void checkNullParameter(String parameterName, Object value)
       {
           if (value == null)
  -            throw new IllegalArgumentException(
  -                HiveMindMessages.nullParameterInvalid(parameterName));
  +            throw new IllegalArgumentException(HiveMindMessages.nullParameterInvalid(parameterName));
       }
   
       /**
  @@ -163,4 +167,4 @@
       {
           return c == null || c.isEmpty();
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.70      +9 -0      jakarta-hivemind/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/status.xml,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- status.xml	27 Oct 2004 15:16:55 -0000	1.69
  +++ status.xml	31 Oct 2004 14:44:25 -0000	1.70
  @@ -59,6 +59,15 @@
         <action type="fix" dev="HLS" fixes-bug="HIVEMIND-56" due-to="Bruce Synder">
           CVS connection string on website is incorrect
         </action>
  +      <action type="update" dev="HLS">
  +        Synchronize all access to java.beans.Introspector through a common mutex.
  +      </action>
  +      <action type="update" dev="HLS">
  +        Clear the PropertyUtils and Introspector caches when the Registry is shutdown.
  +      </action>
  +      <action type="fix" dev="HLS" fixes-bug="HIVEMIND-68">
  +        Properly report the actual method name when invoking a service initializer method.
  +      </action>
       </release>
   
      <release version="1.0" date="Sep 22 2004">
  
  
  
  1.2       +6 -0      jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java
  
  Index: RegistryInfrastructureImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RegistryInfrastructureImpl.java	25 Sep 2004 17:08:34 -0000	1.1
  +++ RegistryInfrastructureImpl.java	31 Oct 2004 14:44:25 -0000	1.2
  @@ -41,6 +41,7 @@
   import org.apache.hivemind.order.Orderer;
   import org.apache.hivemind.schema.Translator;
   import org.apache.hivemind.service.ThreadEventNotifier;
  +import org.apache.hivemind.util.PropertyUtils;
   import org.apache.hivemind.util.ToStringBuilder;
   
   /**
  @@ -318,6 +319,11 @@
           _variableSources = null;
           _serviceModelFactories = null;
           _threadEventNotifier = null;
  +        
  +        // It is believed that the cache held by PropertyUtils can affect application shutdown
  +        // and reload in some servlet containers (such as Tomcat); this should clear that
up.
  +        
  +        PropertyUtils.clearCache();
       }
   
       private synchronized void checkShutdown()
  
  
  
  1.4       +2 -2      jakarta-hivemind/hivebuild/forrestdoc.xml
  
  Index: forrestdoc.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/hivebuild/forrestdoc.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- forrestdoc.xml	27 Oct 2004 19:29:35 -0000	1.3
  +++ forrestdoc.xml	31 Oct 2004 14:44:25 -0000	1.4
  @@ -52,10 +52,10 @@
   		
   		<target name="-initialize-report-menu-file">
   		
  -			<mkdir dir="${project.forrest.xdocs.dir}"/>
  +      <dirname property="report-menu.dir" file="${forrest.report-menu.file}"/>
  +			<mkdir dir="${report-menu.dir}"/>
   			
   			<echo message="" file="${forrest.report-menu.file}"/>
  -			
   		</target>  
           
   		<target name="marshall-documentation"
  
  
  

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


Mime
View raw message