hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahue...@apache.org
Subject svn commit: r468963 - in /hivemind/branches/branch-2-0-annot: framework/src/java/org/apache/hivemind/impl/ xml/src/java/org/apache/hivemind/schema/rules/
Date Sun, 29 Oct 2006 19:51:00 GMT
Author: ahuegen
Date: Sun Oct 29 11:51:00 2006
New Revision: 468963

URL: http://svn.apache.org/viewvc?view=rev&rev=468963
Log:
Fixed some bugs 

Modified:
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/ConfigurationTranslator.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/InvokeParentRule.java

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java?view=diff&rev=468963&r1=468962&r2=468963
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java
Sun Oct 29 11:51:00 2006
@@ -84,8 +84,7 @@
 
     public RegistryBuilder()
     {
-        this(new DefaultErrorHandler());
-        _registryDefinition = new RegistryDefinition();
+        this(new RegistryDefinition(), new DefaultErrorHandler());
     }
     
     public RegistryBuilder(RegistryDefinition registryDefinition)
@@ -93,15 +92,15 @@
         this(registryDefinition, new DefaultErrorHandler());
     }
 
-    public RegistryBuilder(ErrorHandler handler)
+    public RegistryBuilder(ErrorHandler errorHandler)
     {
-        _errorHandler = handler;
+        this(new RegistryDefinition(), errorHandler);
     }
     
-    public RegistryBuilder(RegistryDefinition registryDefinition, ErrorHandler handler)
+    public RegistryBuilder(RegistryDefinition registryDefinition, ErrorHandler errorHandler)
     {
         _registryDefinition = registryDefinition;
-        _errorHandler = handler;
+        _errorHandler = errorHandler;
     }
 
     public RegistryDefinition getRegistryDefinition()

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java?view=diff&rev=468963&r1=468962&r2=468963
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java
Sun Oct 29 11:51:00 2006
@@ -387,6 +387,7 @@
         _serviceModelFactories = null;
         _threadEventNotifier = null;
         _serviceTokens = null;
+        _natures = 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.

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/ConfigurationTranslator.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/ConfigurationTranslator.java?view=diff&rev=468963&r1=468962&r2=468963
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/ConfigurationTranslator.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/ConfigurationTranslator.java
Sun Oct 29 11:51:00 2006
@@ -14,6 +14,10 @@
 
 package org.apache.hivemind.schema.rules;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.hivemind.HiveMind;
 import org.apache.hivemind.Location;
 import org.apache.hivemind.internal.Module;
@@ -33,6 +37,14 @@
         if (HiveMind.isBlank(inputValue))
             return null;
 
-        return contributingModule.getConfiguration(inputValue);
+        // For backward compatibility allow configuratin of type map be assigned to
+        // properties of type List. Drawback: Lazy construction of the configuration
+        // gets lost. The configuration is constructed right here during the conversion
+        Object configuration = contributingModule.getConfiguration(inputValue);
+        if (configuration instanceof Map && propertyType.equals(List.class)) {
+            configuration = new ArrayList(((Map) configuration).values());
+        }
+        
+        return configuration;
     }
 }

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/InvokeParentRule.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/InvokeParentRule.java?view=diff&rev=468963&r1=468962&r2=468963
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/InvokeParentRule.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/InvokeParentRule.java
Sun Oct 29 11:51:00 2006
@@ -62,35 +62,37 @@
                 parameterTypes[i] = parameters[i].getClass();
         }
 
+        String methodName = _methodName;
         Object parent = processor.peek(_parameterCount + _depth - 1);
-        if (processor.isInBackwardCompatibilityModeForMaps() && _parameterCount ==
1) {
-            _methodName = "addKeyedElement";
+        if (processor.isInBackwardCompatibilityModeForMaps() && _parameterCount ==
1
+                && ("addElement".equals(_methodName) || "add".equals(_methodName)))
{
+            methodName = "addKeyedElement";
             // We can't call the map (parent) directly, since we must calculate the key attribute
             // value, but don't have access to its definition.
             // Let the processor do the work. It knows the current element-model and its
attributes
             parent = processor;
         } else if (parent instanceof List && "addElement".equals(_methodName) ) {
-                // For Backward compatiblity: If parent is a list and the method is 'addElement'
-                // then change it to add. 
-                _methodName = "add"; 
+            // For Backward compatiblity: If parent is a list and the method is 'addElement'
+            // then change it to add. 
+            methodName = "add"; 
         }
         
         try
         {
-            Method m = findMethod(parent, _methodName, parameterTypes);
+            Method m = findMethod(parent, methodName, parameterTypes);
 
             m.invoke(parent, parameters);
         }
         catch (InvocationTargetException ex) {
             throw new ApplicationRuntimeException(RulesMessages.errorInvokingMethod(
-                    _methodName,
+                    methodName,
                     parent,
                     getLocation(),
                     ex.getTargetException()), getLocation(), ex.getTargetException());
         } catch (Exception ex)
         {
             throw new ApplicationRuntimeException(RulesMessages.errorInvokingMethod(
-                    _methodName,
+                    methodName,
                     parent,
                     getLocation(),
                     ex), getLocation(), ex);



Mime
View raw message