You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2008/08/04 05:00:57 UTC

svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Author: doogie
Date: Sun Aug  3 20:00:54 2008
New Revision: 682246

URL: http://svn.apache.org/viewvc?rev=682246&view=rev
Log:
Generification, enhanced-for, FastMap/FastList changes.

Modified:
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMapProcessor.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethodBsfEngine.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleServiceEngine.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/FieldObject.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/FieldString.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodObject.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/StringObject.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/AddError.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallBsh.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallClassMethod.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallObjectMethod.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallService.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallServiceAsynch.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMethod.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CheckErrors.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CreateObject.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Assert.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CombinedCondition.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareCondition.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareFieldCondition.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Conditional.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ValidateMethodCondition.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearCacheLine.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CloneValue.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByAnd.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByDate.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/GetRelated.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/GetRelatedOne.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/MakeNextSeqId.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/MakeValue.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/NowDateToEnv.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/NowTimestampToEnv.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/OrderValueList.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RefreshValue.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveByAnd.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveList.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveRelated.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SequencedIdToEnv.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetNonpkFields.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetPkFields.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionBegin.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionCommit.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionRollback.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/EnvToEnv.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/EnvToField.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToEnv.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToField.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToList.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ListToList.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/OrderMapList.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetCalendar.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToField.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ToString.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/FieldToRequest.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/FieldToSession.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/RequestParametersToList.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/RequestToField.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/SessionToField.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckId.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfInstanceOf.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfRegexp.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfValidateMethod.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Log.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Compare.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/CompareField.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ConstantOper.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/InFieldOper.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInString.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInStringOperation.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MapProcessor.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/NotEmpty.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Regexp.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapProcess.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ValidateMethod.java

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMapProcessor.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMapProcessor.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMapProcessor.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMapProcessor.java Sun Aug  3 20:00:54 2008
@@ -25,6 +25,8 @@
 import java.util.Locale;
 import java.util.Map;
 
+import javolution.util.FastMap;
+
 import org.ofbiz.base.util.UtilURL;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.cache.UtilCache;
@@ -37,19 +39,19 @@
  */
 public class SimpleMapProcessor {
 
-    protected static UtilCache simpleMapProcessorsResourceCache = new UtilCache("minilang.SimpleMapProcessorsResource", 0, 0);
-    protected static UtilCache simpleMapProcessorsURLCache = new UtilCache("minilang.SimpleMapProcessorsURL", 0, 0);
+    protected static UtilCache<String, Map<String, MapProcessor>> simpleMapProcessorsResourceCache = new UtilCache<String, Map<String, MapProcessor>>("minilang.SimpleMapProcessorsResource", 0, 0);
+    protected static UtilCache<URL, Map<String, MapProcessor>> simpleMapProcessorsURLCache = new UtilCache<URL, Map<String, MapProcessor>>("minilang.SimpleMapProcessorsURL", 0, 0);
 
-    public static void runSimpleMapProcessor(String xmlResource, String name, Map inMap, Map results, List messages, Locale locale) throws MiniLangException {
+    public static void runSimpleMapProcessor(String xmlResource, String name, Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale) throws MiniLangException {
         runSimpleMapProcessor(xmlResource, name, inMap, results, messages, locale, null);
     }
 
-    public static void runSimpleMapProcessor(String xmlResource, String name, Map inMap, Map results, List messages, Locale locale, ClassLoader loader) throws MiniLangException {
+    public static void runSimpleMapProcessor(String xmlResource, String name, Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) throws MiniLangException {
         if (loader == null)
             loader = Thread.currentThread().getContextClassLoader();
 
-        Map mapProcessors = getProcessors(xmlResource, name, loader);
-        MapProcessor processor = (MapProcessor) mapProcessors.get(name);
+        Map<String, MapProcessor> mapProcessors = getProcessors(xmlResource, name, loader);
+        MapProcessor processor = mapProcessors.get(name);
 
         if (processor == null) {
             throw new MiniLangException("Could not find SimpleMapProcessor named " + name + " in XML document resource: " + xmlResource);
@@ -59,12 +61,12 @@
             processor.exec(inMap, results, messages, locale, loader);
     }
 
-    public static void runSimpleMapProcessor(URL xmlURL, String name, Map inMap, Map results, List messages, Locale locale, ClassLoader loader) throws MiniLangException {
+    public static void runSimpleMapProcessor(URL xmlURL, String name, Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) throws MiniLangException {
         if (loader == null)
             loader = Thread.currentThread().getContextClassLoader();
 
-        Map mapProcessors = getProcessors(xmlURL, name);
-        MapProcessor processor = (MapProcessor) mapProcessors.get(name);
+        Map<String, MapProcessor> mapProcessors = getProcessors(xmlURL, name);
+        MapProcessor processor = mapProcessors.get(name);
 
         if (processor == null) {
             throw new MiniLangException("Could not find SimpleMapProcessor named " + name + " in XML document: " + xmlURL.toString());
@@ -74,12 +76,12 @@
             processor.exec(inMap, results, messages, locale, loader);
     }
 
-    protected static Map getProcessors(String xmlResource, String name, ClassLoader loader) throws MiniLangException {
-        Map simpleMapProcessors = (Map) simpleMapProcessorsResourceCache.get(xmlResource);
+    protected static Map<String, MapProcessor> getProcessors(String xmlResource, String name, ClassLoader loader) throws MiniLangException {
+        Map<String, MapProcessor> simpleMapProcessors = simpleMapProcessorsResourceCache.get(xmlResource);
 
         if (simpleMapProcessors == null) {
             synchronized (SimpleMapProcessor.class) {
-                simpleMapProcessors = (Map) simpleMapProcessorsResourceCache.get(xmlResource);
+                simpleMapProcessors = simpleMapProcessorsResourceCache.get(xmlResource);
                 if (simpleMapProcessors == null) {
                     URL xmlURL = UtilURL.fromResource(xmlResource, loader);
 
@@ -97,12 +99,12 @@
         return simpleMapProcessors;
     }
 
-    protected static Map getProcessors(URL xmlURL, String name) throws MiniLangException {
-        Map simpleMapProcessors = (Map) simpleMapProcessorsURLCache.get(xmlURL);
+    protected static Map<String, MapProcessor> getProcessors(URL xmlURL, String name) throws MiniLangException {
+        Map<String, MapProcessor> simpleMapProcessors = simpleMapProcessorsURLCache.get(xmlURL);
 
         if (simpleMapProcessors == null) {
             synchronized (SimpleMapProcessor.class) {
-                simpleMapProcessors = (Map) simpleMapProcessorsURLCache.get(xmlURL);
+                simpleMapProcessors = simpleMapProcessorsURLCache.get(xmlURL);
                 if (simpleMapProcessors == null) {
                     simpleMapProcessors = getAllProcessors(xmlURL);
 
@@ -115,8 +117,8 @@
         return simpleMapProcessors;
     }
 
-    protected static Map getAllProcessors(URL xmlURL) throws MiniLangException {
-        Map mapProcessors = new HashMap();
+    protected static Map<String, MapProcessor> getAllProcessors(URL xmlURL) throws MiniLangException {
+        Map<String, MapProcessor> mapProcessors = FastMap.newInstance();
 
         // read in the file
         Document document = null;
@@ -136,11 +138,7 @@
         }
 
         Element rootElement = document.getDocumentElement();
-        List simpleMapProcessorElements = UtilXml.childElementList(rootElement, "simple-map-processor");
-        Iterator strProcorIter = simpleMapProcessorElements.iterator();
-
-        while (strProcorIter.hasNext()) {
-            Element simpleMapProcessorElement = (Element) strProcorIter.next();
+        for (Element simpleMapProcessorElement: UtilXml.childElementList(rootElement, "simple-map-processor")) {
             MapProcessor processor = new MapProcessor(simpleMapProcessorElement);
 
             mapProcessors.put(simpleMapProcessorElement.getAttribute("name"), processor);

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java Sun Aug  3 20:00:54 2008
@@ -35,6 +35,7 @@
 
 import org.ofbiz.base.location.FlexibleLocation;
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
@@ -85,9 +86,9 @@
     public static final String module = SimpleMethod.class.getName();
     public static final String err_resource = "MiniLangErrorUiLabels";
 
-    protected static UtilCache<String, Map<String, SimpleMethod>> simpleMethodsDirectCache = new UtilCache("minilang.SimpleMethodsDirect", 0, 0);
-    protected static UtilCache<String, Map<String, SimpleMethod>> simpleMethodsResourceCache = new UtilCache("minilang.SimpleMethodsResource", 0, 0);
-    protected static UtilCache<URL, Map<String, SimpleMethod>> simpleMethodsURLCache = new UtilCache("minilang.SimpleMethodsURL", 0, 0);
+    protected static UtilCache<String, Map<String, SimpleMethod>> simpleMethodsDirectCache = new UtilCache<String, Map<String, SimpleMethod>>("minilang.SimpleMethodsDirect", 0, 0);
+    protected static UtilCache<String, Map<String, SimpleMethod>> simpleMethodsResourceCache = new UtilCache<String, Map<String, SimpleMethod>>("minilang.SimpleMethodsResource", 0, 0);
+    protected static UtilCache<URL, Map<String, SimpleMethod>> simpleMethodsURLCache = new UtilCache<URL, Map<String, SimpleMethod>>("minilang.SimpleMethodsURL", 0, 0);
 
     // ----- Event Context Invokers -----
 
@@ -105,19 +106,19 @@
 
     // ----- Service Context Invokers -----
 
-    public static Map runSimpleService(String xmlResource, String methodName, DispatchContext ctx, Map context) throws MiniLangException {
+    public static Map<String, Object> runSimpleService(String xmlResource, String methodName, DispatchContext ctx, Map<String, ? extends Object> context) throws MiniLangException {
         MethodContext methodContext = new MethodContext(ctx, context, null);
         runSimpleMethod(xmlResource, methodName, methodContext);
         return methodContext.getResults();
     }
 
-    public static Map runSimpleService(String xmlResource, String methodName, DispatchContext ctx, Map context, ClassLoader loader) throws MiniLangException {
+    public static Map<String, Object> runSimpleService(String xmlResource, String methodName, DispatchContext ctx, Map<String, ? extends Object> context, ClassLoader loader) throws MiniLangException {
         MethodContext methodContext = new MethodContext(ctx, context, loader);
         runSimpleMethod(xmlResource, methodName, methodContext);
         return methodContext.getResults();
     }
 
-    public static Map runSimpleService(URL xmlURL, String methodName, DispatchContext ctx, Map context, ClassLoader loader) throws MiniLangException {
+    public static Map<String, Object> runSimpleService(URL xmlURL, String methodName, DispatchContext ctx, Map<String, ? extends Object> context, ClassLoader loader) throws MiniLangException {
         MethodContext methodContext = new MethodContext(ctx, context, loader);
         runSimpleMethod(xmlURL, methodName, methodContext);
         return methodContext.getResults();
@@ -126,8 +127,8 @@
     // ----- General Method Invokers -----
 
     public static String runSimpleMethod(String xmlResource, String methodName, MethodContext methodContext) throws MiniLangException {
-        Map simpleMethods = getSimpleMethods(xmlResource, methodContext.getLoader());
-        SimpleMethod simpleMethod = (SimpleMethod) simpleMethods.get(methodName);
+        Map<String, SimpleMethod> simpleMethods = getSimpleMethods(xmlResource, methodContext.getLoader());
+        SimpleMethod simpleMethod = simpleMethods.get(methodName);
         if (simpleMethod == null) {
             throw new MiniLangException("Could not find SimpleMethod " + methodName + " in XML document in resource: " + xmlResource);
         }
@@ -135,8 +136,8 @@
     }
 
     public static String runSimpleMethod(URL xmlURL, String methodName, MethodContext methodContext) throws MiniLangException {
-        Map simpleMethods = getSimpleMethods(xmlURL);
-        SimpleMethod simpleMethod = (SimpleMethod) simpleMethods.get(methodName);
+        Map<String, SimpleMethod> simpleMethods = getSimpleMethods(xmlURL);
+        SimpleMethod simpleMethod = simpleMethods.get(methodName);
         if (simpleMethod == null) {
             throw new MiniLangException("Could not find SimpleMethod " + methodName + " in XML document from URL: " + xmlURL.toString());
         }
@@ -144,10 +145,10 @@
     }
 
     public static Map<String, SimpleMethod> getSimpleMethods(String xmlResource, ClassLoader loader) throws MiniLangException {
-        Map<String, SimpleMethod> simpleMethods = (Map) simpleMethodsResourceCache.get(xmlResource);
+        Map<String, SimpleMethod> simpleMethods = simpleMethodsResourceCache.get(xmlResource);
         if (simpleMethods == null) {
             synchronized (SimpleMethod.class) {
-                simpleMethods = (Map) simpleMethodsResourceCache.get(xmlResource);
+                simpleMethods = simpleMethodsResourceCache.get(xmlResource);
                 if (simpleMethods == null) {
                     //URL xmlURL = UtilURL.fromResource(xmlResource, loader);
                     URL xmlURL = null;
@@ -172,11 +173,11 @@
     }
 
     public static Map<String, SimpleMethod> getSimpleMethods(URL xmlURL) throws MiniLangException {
-        Map<String, SimpleMethod> simpleMethods = (Map) simpleMethodsURLCache.get(xmlURL);
+        Map<String, SimpleMethod> simpleMethods = simpleMethodsURLCache.get(xmlURL);
 
         if (simpleMethods == null) {
             synchronized (SimpleMethod.class) {
-                simpleMethods = (Map) simpleMethodsURLCache.get(xmlURL);
+                simpleMethods = simpleMethodsURLCache.get(xmlURL);
                 if (simpleMethods == null) {
                     simpleMethods = getAllSimpleMethods(xmlURL);
 
@@ -209,12 +210,7 @@
         }
 
         Element rootElement = document.getDocumentElement();
-        List simpleMethodElements = UtilXml.childElementList(rootElement, "simple-method");
-
-        Iterator simpleMethodIter = simpleMethodElements.iterator();
-
-        while (simpleMethodIter.hasNext()) {
-            Element simpleMethodElement = (Element) simpleMethodIter.next();
+        for (Element simpleMethodElement: UtilXml.childElementList(rootElement, "simple-method")) {
             SimpleMethod simpleMethod = new SimpleMethod(simpleMethodElement, simpleMethods, xmlURL.toString());
             simpleMethods.put(simpleMethod.getMethodName(), simpleMethod);
         }
@@ -222,12 +218,12 @@
         return simpleMethods;
     }
 
-    public static Map getDirectSimpleMethods(String name, String content, String fromLocation) throws MiniLangException {
-        Map simpleMethods = (Map) simpleMethodsDirectCache.get(name);
+    public static Map<String, SimpleMethod> getDirectSimpleMethods(String name, String content, String fromLocation) throws MiniLangException {
+        Map<String, SimpleMethod> simpleMethods = simpleMethodsDirectCache.get(name);
 
         if (simpleMethods == null) {
             synchronized (SimpleMethod.class) {
-                simpleMethods = (Map) simpleMethodsDirectCache.get(name);
+                simpleMethods = simpleMethodsDirectCache.get(name);
                 if (simpleMethods == null) {
                     simpleMethods = getAllDirectSimpleMethods(name, content, fromLocation);
 
@@ -240,12 +236,12 @@
         return simpleMethods;
     }
 
-    protected static Map getAllDirectSimpleMethods(String name, String content, String fromLocation) throws MiniLangException {
+    protected static Map<String, SimpleMethod> getAllDirectSimpleMethods(String name, String content, String fromLocation) throws MiniLangException {
         if (UtilValidate.isEmpty(fromLocation)) {
             fromLocation = "<location not known>";
         }
         
-        Map simpleMethods = FastMap.newInstance();
+        Map<String, SimpleMethod> simpleMethods = FastMap.newInstance();
 
         // read in the file
         Document document = null;
@@ -267,12 +263,7 @@
         }
 
         Element rootElement = document.getDocumentElement();
-        List simpleMethodElements = UtilXml.childElementList(rootElement, "simple-method");
-
-        Iterator simpleMethodIter = simpleMethodElements.iterator();
-
-        while (simpleMethodIter.hasNext()) {
-            Element simpleMethodElement = (Element) simpleMethodIter.next();
+        for (Element simpleMethodElement: UtilXml.childElementList(rootElement, "simple-method")) {
             SimpleMethod simpleMethod = new SimpleMethod(simpleMethodElement, simpleMethods, fromLocation);
             simpleMethods.put(simpleMethod.getMethodName(), simpleMethod);
         }
@@ -282,7 +273,7 @@
 
     // Member fields begin here...
     protected List<MethodOperation> methodOperations = FastList.newInstance();
-    protected Map parentSimpleMethodsMap;
+    protected Map<String, SimpleMethod> parentSimpleMethodsMap;
     protected String fromLocation;
     protected String methodName;
     protected String shortDescription;
@@ -318,7 +309,7 @@
     protected String dispatcherName;
     protected String userLoginName;
 
-    public SimpleMethod(Element simpleMethodElement, Map parentSimpleMethodsMap, String fromLocation) {
+    public SimpleMethod(Element simpleMethodElement, Map<String, SimpleMethod> parentSimpleMethodsMap, String fromLocation) {
         this.parentSimpleMethodsMap = parentSimpleMethodsMap;
         this.fromLocation = fromLocation;
         this.methodName = simpleMethodElement.getAttribute("method-name");
@@ -436,7 +427,7 @@
 
     public SimpleMethod getSimpleMethodInSameFile(String simpleMethodName) {
         if (parentSimpleMethodsMap == null) return null;
-        return (SimpleMethod) parentSimpleMethodsMap.get(simpleMethodName);
+        return parentSimpleMethodsMap.get(simpleMethodName);
     }
 
     public String getShortDescription() {
@@ -701,7 +692,7 @@
         }
         if (loginRequired) {
             if (userLogin == null) {
-                Map messageMap = UtilMisc.toMap("shortDescription", shortDescription);
+                Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("shortDescription", shortDescription);
                 String errMsg = UtilProperties.getMessage(SimpleMethod.err_resource, "simpleMethod.must_logged_process", messageMap, locale) + ".";
 
                 if (methodContext.getMethodType() == MethodContext.EVENT) {
@@ -752,7 +743,7 @@
         
         String returnValue = null;
         String response = null;
-        StringBuffer summaryErrorStringBuffer = new StringBuffer();
+        StringBuilder summaryErrorStringBuffer = new StringBuilder();
         if (methodContext.getMethodType() == MethodContext.EVENT) {
             boolean forceError = false;
             
@@ -764,7 +755,7 @@
                 
                 summaryErrorStringBuffer.append(errorMsg);
             }
-            List tempErrorMsgList = (List) methodContext.getEnv(eventErrorMessageListName);
+            List<Object> tempErrorMsgList = UtilGenerics.checkList(methodContext.getEnv(eventErrorMessageListName));
             if (tempErrorMsgList != null && tempErrorMsgList.size() > 0) {
                 methodContext.getRequest().setAttribute("_ERROR_MESSAGE_LIST_", tempErrorMsgList);
                 forceError = true;
@@ -777,7 +768,7 @@
             if (eventMsg != null && eventMsg.length() > 0) {
                 methodContext.getRequest().setAttribute("_EVENT_MESSAGE_", eventMsg);
             }
-            List eventMsgList = (List) methodContext.getEnv(eventEventMessageListName);
+            List<String> eventMsgList = UtilGenerics.checkList(methodContext.getEnv(eventEventMessageListName));
             if (eventMsgList != null && eventMsgList.size() > 0) {
                 methodContext.getRequest().setAttribute("_EVENT_MESSAGE_LIST_", eventMsgList);
             }
@@ -808,7 +799,7 @@
                 summaryErrorStringBuffer.append(errorMsg);
             }
 
-            List errorMsgList = (List) methodContext.getEnv(serviceErrorMessageListName);
+            List<Object> errorMsgList = UtilGenerics.checkList(methodContext.getEnv(serviceErrorMessageListName));
             if (errorMsgList != null && errorMsgList.size() > 0) {
                 methodContext.putResult(ModelService.ERROR_MESSAGE_LIST, errorMsgList);
                 forceError = true;
@@ -817,7 +808,7 @@
                 summaryErrorStringBuffer.append(errorMsgList.toString());
             }
 
-            Map errorMsgMap = (Map) methodContext.getEnv(serviceErrorMessageMapName);
+            Map<String, Object> errorMsgMap = UtilGenerics.checkMap(methodContext.getEnv(serviceErrorMessageMapName));
             if (errorMsgMap != null && errorMsgMap.size() > 0) {
                 methodContext.putResult(ModelService.ERROR_MESSAGE_MAP, errorMsgMap);
                 forceError = true;
@@ -831,7 +822,7 @@
                 methodContext.putResult(ModelService.SUCCESS_MESSAGE, successMsg);
             }
 
-            List successMsgList = (List) methodContext.getEnv(serviceSuccessMessageListName);
+            List<Object> successMsgList = UtilGenerics.checkList(methodContext.getEnv(serviceSuccessMessageListName));
             if (successMsgList != null && successMsgList.size() > 0) {
                 methodContext.putResult(ModelService.SUCCESS_MESSAGE_LIST, successMsgList);
             }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethodBsfEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethodBsfEngine.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethodBsfEngine.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethodBsfEngine.java Sun Aug  3 20:00:54 2008
@@ -18,11 +18,12 @@
  *******************************************************************************/
 package org.ofbiz.minilang;
 
-import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 import java.util.Vector;
 
+import javolution.util.FastMap;
+
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.minilang.method.MethodContext;
 
@@ -42,7 +43,7 @@
     
     public static final String module = SimpleMethodBsfEngine.class.getName();
     
-    protected Map context = new HashMap();
+    protected Map<String, Object> context = FastMap.newInstance();
     
     public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException {
         super.initialize(mgr, lang, declaredBeans);
@@ -87,19 +88,19 @@
         if (!(expr instanceof String)) throw new BSFException("simple-method expression must be a string");
 
         //right now only supports one method per file, so get all methods and just run the first...
-        Map simpleMethods = null;
+        Map<String, SimpleMethod> simpleMethods = null;
         try {
             simpleMethods = SimpleMethod.getDirectSimpleMethods(source, (String) expr, "<bsf source>");
         } catch (MiniLangException e) {
             throw new BSFException("Error loading/parsing simple-method XML source: " + e.getMessage());
         }
-        Set smNames = simpleMethods.keySet();
+        Set<String> smNames = simpleMethods.keySet();
         if (smNames.size() == 0) throw new BSFException("Did not find any simple-methods in the file");
 
-        String methodName = (String) smNames.iterator().next();
+        String methodName = smNames.iterator().next();
         if (smNames.size() > 1) Debug.logWarning("Found more than one simple-method in the file, running the [" + methodName + "] method, you should remove all but one method from this file", module);
 
-        SimpleMethod simpleMethod = (SimpleMethod) simpleMethods.get(methodName);
+        SimpleMethod simpleMethod = simpleMethods.get(methodName);
         MethodContext methodContext = new MethodContext(context, null, MethodContext.EVENT);
         return simpleMethod.exec(methodContext);
         //methodContext.getResults();

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleServiceEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleServiceEngine.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleServiceEngine.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleServiceEngine.java Sun Aug  3 20:00:54 2008
@@ -39,23 +39,23 @@
     /** Run the service synchronously and IGNORE the result
      * @param context Map of name, value pairs composing the context
      */
-    public void runSyncIgnore(String localName, ModelService modelService, Map context) throws GenericServiceException {        
-        Map result = runSync(localName, modelService, context);
+    public void runSyncIgnore(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException {        
+        Map<String, Object> result = runSync(localName, modelService, context);
     }
 
     /** Run the service synchronously and return the result
      * @param context Map of name, value pairs composing the context
      * @return Map of name, value pairs composing the result
      */
-    public Map runSync(String localName, ModelService modelService, Map context) throws GenericServiceException {        
-        Object result = serviceInvoker(localName, modelService, context);
-        if (result == null || !(result instanceof Map))
+    public Map<String, Object> runSync(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException {        
+        Map<String, Object> result = serviceInvoker(localName, modelService, context);
+        if (result == null)
             throw new GenericServiceException("Service did not return expected result");
-        return (Map) result;
+        return result;
     }
 
     // Invoke the simple method from a service context
-    private Object serviceInvoker(String localName, ModelService modelService, Map context) throws GenericServiceException {        
+    private Map<String, Object> serviceInvoker(String localName, ModelService modelService, Map<String, ? extends Object> context) throws GenericServiceException {        
         // static java service methods should be: public Map methodName(DispatchContext dctx, Map context)
         DispatchContext dctx = dispatcher.getLocalContext(localName);
 

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java Sun Aug  3 20:00:54 2008
@@ -20,6 +20,7 @@
 
 import java.util.Map;
 
+import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.collections.FlexibleMapAccessor;
 
 /**
@@ -27,10 +28,10 @@
  * accessing sub-map values and the "[]" (square bracket) syntax for accessing
  * list elements. See individual Map operations for more information.
  */
-public class ContextAccessor {
+public class ContextAccessor<T> {
 
     protected String name;
-    protected FlexibleMapAccessor fma;
+    protected FlexibleMapAccessor<T> fma;
     protected boolean needsExpand;
     protected boolean empty;
 
@@ -51,7 +52,7 @@
         if (name == null || name.length() == 0) {
             empty = true;
             needsExpand = false;
-            fma = new FlexibleMapAccessor(name);
+            fma = new FlexibleMapAccessor<T>(name);
         } else {
             empty = false;
             int openPos = name.indexOf("${");
@@ -59,7 +60,7 @@
                 fma = null;
                 needsExpand = true;
             } else {
-                fma = new FlexibleMapAccessor(name);
+                fma = new FlexibleMapAccessor<T>(name);
                 needsExpand = false;
             }
         }
@@ -70,11 +71,11 @@
     }
     
     /** Based on name get from Map or from List in Map */
-    public Object get(MethodContext methodContext) {
+    public T get(MethodContext methodContext) {
         if (this.needsExpand) {
-            return methodContext.getEnv(name);
+            return UtilGenerics.<T>cast(methodContext.getEnv(name));
         } else {
-            return methodContext.getEnv(fma);
+            return UtilGenerics.<T>cast(methodContext.getEnv(fma));
         }
     }
     
@@ -84,7 +85,7 @@
      * If a "+" (plus sign) is included inside the square brackets before the index 
      * number the value will inserted/added at that point instead of set at the point.
      */
-    public void put(MethodContext methodContext, Object value) {
+    public void put(MethodContext methodContext, T value) {
         if (this.needsExpand) {
             methodContext.putEnv(name, value);
         } else {
@@ -93,18 +94,18 @@
     }
     
     /** Based on name remove from Map or from List in Map */
-    public Object remove(MethodContext methodContext) {
+    public T remove(MethodContext methodContext) {
         if (this.needsExpand) {
-            return methodContext.removeEnv(name);
+            return UtilGenerics.<T>cast(methodContext.removeEnv(name));
         } else {
-            return methodContext.removeEnv(fma);
+            return UtilGenerics.<T>cast(methodContext.removeEnv(fma));
         }
     }
     
     /** Based on name get from Map or from List in Map */
-    public Object get(Map theMap, MethodContext methodContext) {
+    public T get(Map<String, ? extends Object> theMap, MethodContext methodContext) {
         if (this.needsExpand) {
-            FlexibleMapAccessor fma = new FlexibleMapAccessor(methodContext.expandString(name));
+            FlexibleMapAccessor<T> fma = new FlexibleMapAccessor<T>(methodContext.expandString(name));
             return fma.get(theMap);
         } else {
             return fma.get(theMap);
@@ -117,9 +118,9 @@
      * If a "+" (plus sign) is included inside the square brackets before the index 
      * number the value will inserted/added at that point instead of set at the point.
      */
-    public void put(Map theMap, Object value, MethodContext methodContext) {
+    public void put(Map<String, Object> theMap, T value, MethodContext methodContext) {
         if (this.needsExpand) {
-            FlexibleMapAccessor fma = new FlexibleMapAccessor(methodContext.expandString(name));
+            FlexibleMapAccessor<T> fma = new FlexibleMapAccessor<T>(methodContext.expandString(name));
             fma.put(theMap, value);
         } else {
             fma.put(theMap, value);
@@ -127,9 +128,9 @@
     }
     
     /** Based on name remove from Map or from List in Map */
-    public Object remove(Map theMap, MethodContext methodContext) {
+    public T remove(Map<String, ? extends Object> theMap, MethodContext methodContext) {
         if (this.needsExpand) {
-            FlexibleMapAccessor fma = new FlexibleMapAccessor(methodContext.expandString(name));
+            FlexibleMapAccessor<T> fma = new FlexibleMapAccessor<T>(methodContext.expandString(name));
             return fma.remove(theMap);
         } else {
             return fma.remove(theMap);

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/FieldObject.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/FieldObject.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/FieldObject.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/FieldObject.java Sun Aug  3 20:00:54 2008
@@ -27,18 +27,18 @@
 /**
  * A type of MethodObject that represents an Object value in a certain location
  */
-public class FieldObject extends MethodObject {
+public class FieldObject<T> extends MethodObject<T> {
     
     public static final String module = FieldObject.class.getName();
     
-    ContextAccessor fieldAcsr;
-    ContextAccessor mapAcsr;
+    ContextAccessor<T> fieldAcsr;
+    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
     String type;
 
     public FieldObject(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
-        fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
-        mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
+        fieldAcsr = new ContextAccessor<T>(element.getAttribute("field-name"));
+        mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
         type = element.getAttribute("type");
         if (UtilValidate.isEmpty(type)) {
             type = "String";
@@ -50,20 +50,20 @@
         return type;
     }
     
-    public Class getTypeClass(ClassLoader loader) {
+    public Class<T> getTypeClass(ClassLoader loader) {
         try {
-            return ObjectType.loadClass(type, loader);
+            return UtilGenerics.cast(ObjectType.loadClass(type, loader));
         } catch (ClassNotFoundException e) {
             Debug.logError(e, "Could not find class for type: " + type, module);
             return null;
         }
     }
     
-    public Object getObject(MethodContext methodContext) {
-        Object fieldVal = null;
+    public T getObject(MethodContext methodContext) {
+        T fieldVal = null;
 
         if (!mapAcsr.isEmpty()) {
-            Map fromMap = (Map) mapAcsr.get(methodContext);
+            Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
             if (fromMap == null) {
                 Debug.logWarning("Map not found with name " + mapAcsr + ", not getting Object value, returning null.", module);
                 return null;

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/FieldString.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/FieldString.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/FieldString.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/FieldString.java Sun Aug  3 20:00:54 2008
@@ -31,19 +31,19 @@
     
     public static final String module = FieldString.class.getName();
     
-    ContextAccessor fieldAcsr;
-    ContextAccessor mapAcsr;
+    ContextAccessor<Object> fieldAcsr;
+    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
 
     public FieldString(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
-        fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
-        mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
+        fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
+        mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
     }
 
     public String getString(MethodContext methodContext) {
         Object fieldVal = null;
         if (!mapAcsr.isEmpty()) {
-            Map fromMap = (Map) mapAcsr.get(methodContext);
+            Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
             if (fromMap == null) {
                 Debug.logWarning("Map not found with name " + mapAcsr + ", not getting string value", module);
                 return "";

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java Sun Aug  3 20:00:54 2008
@@ -18,15 +18,18 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method;
 
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Map;
 import java.util.TimeZone;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import javolution.util.FastMap;
+
+import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.collections.FlexibleMapAccessor;
 import org.ofbiz.base.util.string.FlexibleStringExpander;
@@ -40,15 +43,15 @@
 /**
  * A single operation, does the specified operation on the given field
  */
-public class MethodContext {
+public class MethodContext implements Iterable<Map.Entry<String, Object>> {
     
     public static final int EVENT = 1;
     public static final int SERVICE = 2;
 
     protected int methodType;
 
-    protected Map<String, Object> env = new HashMap<String, Object>();
-    protected Map parameters;
+    protected Map<String, Object> env = FastMap.newInstance();
+    protected Map<String, Object> parameters;
     protected Locale locale;
     protected TimeZone timeZone;
     protected ClassLoader loader;
@@ -85,16 +88,16 @@
         }
     }
 
-    public MethodContext(DispatchContext ctx, Map context, ClassLoader loader) {
+    public MethodContext(DispatchContext ctx, Map<String, ? extends Object> context, ClassLoader loader) {
         this.methodType = MethodContext.SERVICE;
-        this.parameters = context;
+        this.parameters = UtilMisc.makeMapWritable(context);
         this.loader = loader;
         this.locale = (Locale) context.get("locale");
         this.timeZone = (TimeZone) context.get("timeZone");
         this.dispatcher = ctx.getDispatcher();
         this.delegator = ctx.getDelegator();
         this.security = ctx.getSecurity();
-        this.results = new HashMap<String, Object>();
+        this.results = FastMap.newInstance();
         this.userLogin = (GenericValue) context.get("userLogin");
 
         if (this.loader == null) {
@@ -111,9 +114,9 @@
      * delegator, security, request, response, etc) are in the context. 
      * Will result in calling method as a service or event, as specified.
      */    
-    public MethodContext(Map context, ClassLoader loader, int methodType) {
+    public MethodContext(Map<String, ? extends Object> context, ClassLoader loader, int methodType) {
         this.methodType = methodType;
-        this.parameters = context;
+        this.parameters = UtilMisc.makeMapWritable(context);
         this.loader = loader;
         this.locale = (Locale) context.get("locale");
         this.timeZone = (TimeZone) context.get("timeZone");
@@ -138,7 +141,7 @@
                 if (this.userLogin == null) this.userLogin = (GenericValue) this.request.getSession().getAttribute("userLogin");
             }
         } else if (methodType == MethodContext.SERVICE) {
-            this.results = new HashMap<String, Object>();
+            this.results = FastMap.newInstance();
         }
         
         if (this.loader == null) {
@@ -164,7 +167,7 @@
         return this.methodType;
     }
 
-    public Map getEnvMap() {
+    public Map<String, Object> getEnvMap() {
         return this.env;
     }
     
@@ -175,12 +178,12 @@
      * @param key The name of the environment value to get. Can contain "." and "[]" syntax elements as described above.
      * @return The environment value if found, otherwise null. 
      */
-    public Object getEnv(String key) {
+    public <T> T getEnv(String key) {
         String ekey = this.expandString(key);
-        FlexibleMapAccessor fma = new FlexibleMapAccessor(ekey);
+        FlexibleMapAccessor<T> fma = new FlexibleMapAccessor<T>(ekey);
         return this.getEnv(fma);
     }
-    public Object getEnv(FlexibleMapAccessor fma) {
+    public <T> T getEnv(FlexibleMapAccessor<T> fma) {
         return fma.get(this.env);
     }
 
@@ -196,23 +199,21 @@
      * @param key The name of the environment value to get. Can contain "." syntax elements as described above.
      * @param value The value to set in the named environment location.
      */
-    public void putEnv(String key, Object value) {
+    public <T> void putEnv(String key, T value) {
         String ekey = this.expandString(key);
-        FlexibleMapAccessor fma = new FlexibleMapAccessor(ekey);
+        FlexibleMapAccessor<T> fma = new FlexibleMapAccessor<T>(ekey);
         this.putEnv(fma, value);
     }
-    public void putEnv(FlexibleMapAccessor fma, Object value) {
+    public <T> void putEnv(FlexibleMapAccessor<T> fma, T value) {
         fma.put(this.env, value);
     }
 
     /** Calls putEnv for each entry in the Map, thus allowing for the additional flexibility in naming 
      * supported in that method. 
      */
-    public void putAllEnv(Map values) {
-        Iterator viter = values.entrySet().iterator();
-        while (viter.hasNext()) {
-            Map.Entry entry = (Map.Entry) viter.next();
-            this.putEnv((String) entry.getKey(), entry.getValue());
+    public void putAllEnv(Map<String, ? extends Object> values) {
+        for (Map.Entry<String, ? extends Object> entry: values.entrySet()) {
+            this.putEnv(entry.getKey(), entry.getValue());
         }
     }
 
@@ -222,16 +223,20 @@
      * 
      * @param key The name of the environment value to get. Can contain "." syntax elements as described above.
      */
-    public Object removeEnv(String key) {
+    public <T> T removeEnv(String key) {
         String ekey = this.expandString(key);
-        FlexibleMapAccessor fma = new FlexibleMapAccessor(ekey);
+        FlexibleMapAccessor<T> fma = new FlexibleMapAccessor<T>(ekey);
         return this.removeEnv(fma);
     }
-    public Object removeEnv(FlexibleMapAccessor fma) {
+    public <T> T removeEnv(FlexibleMapAccessor<T> fma) {
         return fma.remove(this.env);
     }
 
-    public Iterator getEnvEntryIterator() {
+    public Iterator<Map.Entry<String, Object>> iterator() {
+        return this.env.entrySet().iterator();
+    }
+
+    public Iterator<Map.Entry<String, Object>> getEnvEntryIterator() {
         return this.env.entrySet().iterator();
     }
 
@@ -243,7 +248,7 @@
         this.parameters.put(key, value);
     }
 
-    public Map getParameters() {
+    public Map<String, Object> getParameters() {
         return this.parameters;
     }
 

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodObject.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodObject.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodObject.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodObject.java Sun Aug  3 20:00:54 2008
@@ -24,7 +24,7 @@
 /**
  * A single Object value to be used as a parameter or whatever
  */
-public abstract class MethodObject {
+public abstract class MethodObject<T> {
     
     protected SimpleMethod simpleMethod;
 
@@ -36,8 +36,8 @@
     public abstract String getTypeName();
     
     /** Get the Class for the type of the object */
-    public abstract Class getTypeClass(ClassLoader loader);
+    public abstract Class<T> getTypeClass(ClassLoader loader);
     
     /** Get the Object value */
-    public abstract Object getObject(MethodContext methodContext);
+    public abstract T getObject(MethodContext methodContext);
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/StringObject.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/StringObject.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/StringObject.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/StringObject.java Sun Aug  3 20:00:54 2008
@@ -26,7 +26,7 @@
 /**
  * A type of MethodObject that represents a String constant value to be used as an Object
  */
-public class StringObject extends MethodObject {
+public class StringObject extends MethodObject<String> {
     
     String value;
     String cdataValue;
@@ -42,11 +42,11 @@
         return "java.lang.String";
     }
     
-    public Class getTypeClass(ClassLoader loader) {
+    public Class<String> getTypeClass(ClassLoader loader) {
         return java.lang.String.class;
     }
     
-    public Object getObject(MethodContext methodContext) {
+    public String getObject(MethodContext methodContext) {
         String value = methodContext.expandString(this.value);
         String cdataValue = methodContext.expandString(this.cdataValue);
         

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/AddError.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/AddError.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/AddError.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/AddError.java Sun Aug  3 20:00:54 2008
@@ -20,6 +20,8 @@
 
 import java.util.*;
 
+import javolution.util.FastList;
+
 import org.w3c.dom.*;
 import org.ofbiz.base.util.*;
 import org.ofbiz.minilang.*;
@@ -33,11 +35,11 @@
     String propertyResource = null;
     boolean isProperty = false;
 
-    ContextAccessor errorListAcsr;
+    ContextAccessor<List<Object>> errorListAcsr;
 
     public AddError(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
-        errorListAcsr = new ContextAccessor(element.getAttribute("error-list-name"), "error_list");
+        errorListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("error-list-name"), "error_list");
 
         Element failMessage = UtilXml.firstChildElement(element, "fail-message");
         Element failProperty = UtilXml.firstChildElement(element, "fail-property");
@@ -54,9 +56,9 @@
 
     public boolean exec(MethodContext methodContext) {
 
-        List messages = (List) errorListAcsr.get(methodContext);
+        List<Object> messages = errorListAcsr.get(methodContext);
         if (messages == null) {
-            messages = new LinkedList();
+            messages = FastList.newInstance();
             errorListAcsr.put(methodContext, messages);
         }
 
@@ -64,7 +66,7 @@
         return true;
     }
 
-    public void addMessage(List messages, ClassLoader loader, MethodContext methodContext) {
+    public void addMessage(List<Object> messages, ClassLoader loader, MethodContext methodContext) {
         String message = methodContext.expandString(this.message);
         String propertyResource = methodContext.expandString(this.propertyResource);
         

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallBsh.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallBsh.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallBsh.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallBsh.java Sun Aug  3 20:00:54 2008
@@ -21,6 +21,8 @@
 import java.io.*;
 import java.util.*;
 
+import javolution.util.FastList;
+
 import org.w3c.dom.*;
 import org.ofbiz.base.util.*;
 import org.ofbiz.minilang.*;
@@ -39,23 +41,23 @@
 
     String inline = null;
     String resource = null;
-    ContextAccessor errorListAcsr;
+    ContextAccessor<List<Object>> errorListAcsr;
 
     public CallBsh(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
         inline = UtilXml.elementValue(element);
         resource = element.getAttribute("resource");
-        errorListAcsr = new ContextAccessor(element.getAttribute("error-list-name"), "error_list");
+        errorListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("error-list-name"), "error_list");
 
         if (inline != null && inline.length() > 0) {// pre-parse/compile inlined bsh, only accessed here
         }
     }
 
     public boolean exec(MethodContext methodContext) {
-        List messages = (List) errorListAcsr.get(methodContext);
+        List<Object> messages = errorListAcsr.get(methodContext);
 
         if (messages == null) {
-            messages = new LinkedList();
+            messages = FastList.newInstance();
             errorListAcsr.put(methodContext, messages);
         }
 
@@ -64,11 +66,8 @@
 
         try {
             // setup environment
-            Iterator envEntries = methodContext.getEnvEntryIterator();
-
-            while (envEntries.hasNext()) {
-                Map.Entry entry = (Map.Entry) envEntries.next();
-                bsh.set((String) entry.getKey(), entry.getValue());
+            for (Map.Entry<String, Object> entry: methodContext) {
+                bsh.set(entry.getKey(), entry.getValue());
             }
 
             // run external, from resource, first if resource specified
@@ -81,7 +80,7 @@
                 } else {
                     try {
                         BufferedReader reader = new BufferedReader(new InputStreamReader(is));
-                        StringBuffer outSb = new StringBuffer();
+                        StringBuilder outSb = new StringBuilder();
 
                         String tempStr = null;
 
@@ -94,7 +93,7 @@
 
                         // if map is returned, copy values into env
                         if ((resourceResult != null) && (resourceResult instanceof Map)) {
-                            methodContext.putAllEnv((Map) resourceResult);
+                            methodContext.putAllEnv(UtilGenerics.<String, Object>checkMap(resourceResult));
                         }
                     } catch (IOException e) {
                         messages.add("IO error loading bsh resource: " + e.getMessage());
@@ -109,7 +108,7 @@
 
             // if map is returned, copy values into env
             if ((inlineResult != null) && (inlineResult instanceof Map)) {
-                methodContext.putAllEnv((Map) inlineResult);
+                methodContext.putAllEnv(UtilGenerics.<String, Object>checkMap(inlineResult));
             }
         } catch (EvalError e) {
             Debug.logError(e, "BeanShell execution caused an error", module);

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallClassMethod.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallClassMethod.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallClassMethod.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallClassMethod.java Sun Aug  3 20:00:54 2008
@@ -21,6 +21,8 @@
 
 import java.util.*;
 
+import javolution.util.FastList;
+
 import org.w3c.dom.*;
 import org.ofbiz.base.util.*;
 
@@ -36,31 +38,29 @@
 
     String className;
     String methodName;
-    ContextAccessor retFieldAcsr;
-    ContextAccessor retMapAcsr;
+    ContextAccessor<Object> retFieldAcsr;
+    ContextAccessor<Map<String, Object>> retMapAcsr;
 
     /** A list of MethodObject objects to use as the method call parameters */
-    List parameters;
+    List<MethodObject<?>> parameters;
 
     public CallClassMethod(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
         className = element.getAttribute("class-name");
         methodName = element.getAttribute("method-name");
-        retFieldAcsr = new ContextAccessor(element.getAttribute("ret-field-name"));
-        retMapAcsr = new ContextAccessor(element.getAttribute("ret-map-name"));
+        retFieldAcsr = new ContextAccessor<Object>(element.getAttribute("ret-field-name"));
+        retMapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("ret-map-name"));
         
-        List parameterElements = UtilXml.childElementList(element);
+        List<? extends Element> parameterElements = UtilXml.childElementList(element);
         if (parameterElements.size() > 0) {
-            parameters = new ArrayList(parameterElements.size());
+            parameters = FastList.newInstance();
             
-            Iterator parameterIter = parameterElements.iterator();
-            while (parameterIter.hasNext()) {
-                Element parameterElement = (Element) parameterIter.next();
-                MethodObject methodObject = null;
+            for (Element parameterElement: parameterElements) {
+                MethodObject<?> methodObject = null;
                 if ("string".equals(parameterElement.getNodeName())) {
                     methodObject = new StringObject(parameterElement, simpleMethod); 
                 } else if ("field".equals(parameterElement.getNodeName())) {
-                    methodObject = new FieldObject(parameterElement, simpleMethod);
+                    methodObject = new FieldObject<Object>(parameterElement, simpleMethod);
                 } else {
                     //whoops, invalid tag here, print warning
                     Debug.logWarning("Found an unsupported tag under the call-object-method tag: " + parameterElement.getNodeName() + "; ignoring", module);
@@ -76,7 +76,7 @@
         String className = methodContext.expandString(this.className);
         String methodName = methodContext.expandString(this.methodName);
         
-        Class methodClass = null;
+        Class<?> methodClass = null;
         try {
             methodClass = ObjectType.loadClass(className, methodContext.getLoader());
         } catch (ClassNotFoundException e) {

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallObjectMethod.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallObjectMethod.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallObjectMethod.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallObjectMethod.java Sun Aug  3 20:00:54 2008
@@ -21,6 +21,9 @@
 import java.lang.reflect.*;
 import java.util.*;
 
+import javolution.util.FastList;
+import javolution.util.FastMap;
+
 import org.w3c.dom.*;
 import org.ofbiz.base.util.*;
 
@@ -34,35 +37,33 @@
     
     public static final String module = CallClassMethod.class.getName();
 
-    ContextAccessor objFieldAcsr;
-    ContextAccessor objMapAcsr;
+    ContextAccessor<Object> objFieldAcsr;
+    ContextAccessor<Map<String, ? extends Object>> objMapAcsr;
     String methodName;
-    ContextAccessor retFieldAcsr;
-    ContextAccessor retMapAcsr;
+    ContextAccessor<Object> retFieldAcsr;
+    ContextAccessor<Map<String, Object>> retMapAcsr;
 
     /** A list of MethodObject objects to use as the method call parameters */
-    List parameters;
+    List<MethodObject<?>> parameters;
 
     public CallObjectMethod(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
-        objFieldAcsr = new ContextAccessor(element.getAttribute("obj-field-name"));
-        objMapAcsr = new ContextAccessor(element.getAttribute("obj-map-name"));
+        objFieldAcsr = new ContextAccessor<Object>(element.getAttribute("obj-field-name"));
+        objMapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("obj-map-name"));
         methodName = element.getAttribute("method-name");
-        retFieldAcsr = new ContextAccessor(element.getAttribute("ret-field-name"));
-        retMapAcsr = new ContextAccessor(element.getAttribute("ret-map-name"));
+        retFieldAcsr = new ContextAccessor<Object>(element.getAttribute("ret-field-name"));
+        retMapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("ret-map-name"));
         
-        List parameterElements = UtilXml.childElementList(element);
+        List<? extends Element> parameterElements = UtilXml.childElementList(element);
         if (parameterElements.size() > 0) {
-            parameters = new ArrayList(parameterElements.size());
+            parameters = FastList.newInstance();
             
-            Iterator parameterIter = parameterElements.iterator();
-            while (parameterIter.hasNext()) {
-                Element parameterElement = (Element) parameterIter.next();
+            for (Element parameterElement: parameterElements) {
                 MethodObject methodObject = null;
                 if ("string".equals(parameterElement.getNodeName())) {
                     methodObject = new StringObject(parameterElement, simpleMethod); 
                 } else if ("field".equals(parameterElement.getNodeName())) {
-                    methodObject = new FieldObject(parameterElement, simpleMethod);
+                    methodObject = new FieldObject<Object>(parameterElement, simpleMethod);
                 } else {
                     //whoops, invalid tag here, print warning
                     Debug.logWarning("Found an unsupported tag under the call-object-method tag: " + parameterElement.getNodeName() + "; ignoring", module);
@@ -79,7 +80,7 @@
 
         Object methodObject = null;
         if (!objMapAcsr.isEmpty()) {
-            Map fromMap = (Map) objMapAcsr.get(methodContext);
+            Map<String, ? extends Object> fromMap = objMapAcsr.get(methodContext);
             if (fromMap == null) {
                 Debug.logWarning("Map not found with name " + objMapAcsr + ", which should contain the object to execute a method on; not executing method, rerturning error.", module);
                 
@@ -101,25 +102,23 @@
             return false;
         }
 
-        Class methodClass = methodObject.getClass();
+        Class<?> methodClass = methodObject.getClass();
         return CallObjectMethod.callMethod(simpleMethod, methodContext, parameters, methodClass, methodObject, methodName, retFieldAcsr, retMapAcsr);
     }
     
-    public static boolean callMethod(SimpleMethod simpleMethod, MethodContext methodContext, List parameters, Class methodClass, Object methodObject, String methodName, ContextAccessor retFieldAcsr, ContextAccessor retMapAcsr) {
+    public static boolean callMethod(SimpleMethod simpleMethod, MethodContext methodContext, List<MethodObject<?>> parameters, Class<?> methodClass, Object methodObject, String methodName, ContextAccessor<Object> retFieldAcsr, ContextAccessor<Map<String, Object>> retMapAcsr) {
         Object[] args = null;
-        Class[] parameterTypes = null;
+        Class<?>[] parameterTypes = null;
 
         if (parameters != null) {
             args = new Object[parameters.size()];
-            parameterTypes = new Class[parameters.size()];
+            parameterTypes = new Class<?>[parameters.size()];
             
-            Iterator parameterIter = parameters.iterator();
             int i = 0;
-            while (parameterIter.hasNext()) {
-                MethodObject methodObjectDef = (MethodObject) parameterIter.next();
+            for (MethodObject<?> methodObjectDef: parameters) {
                 args[i] = methodObjectDef.getObject(methodContext);
 
-                Class typeClass = methodObjectDef.getTypeClass(methodContext.getLoader());
+                Class<?> typeClass = methodObjectDef.getTypeClass(methodContext.getLoader());
                 if (typeClass == null) {
                     String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [Parameter type not found with name " + methodObjectDef.getTypeName() + "]";
                     Debug.logError(errMsg, module);
@@ -140,10 +139,10 @@
                 //if retFieldAcsr is empty, ignore return value
                 if (!retFieldAcsr.isEmpty()) {
                     if (!retMapAcsr.isEmpty()) {
-                        Map retMap = (Map) retMapAcsr.get(methodContext);
+                        Map<String, Object> retMap = retMapAcsr.get(methodContext);
 
                         if (retMap == null) {
-                            retMap = new HashMap();
+                            retMap = FastMap.newInstance();
                             retMapAcsr.put(methodContext, retMap);
                         }
                         retFieldAcsr.put(retMap, retValue, methodContext);

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallService.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallService.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallService.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallService.java Sun Aug  3 20:00:54 2008
@@ -29,6 +29,7 @@
 import javolution.util.FastMap;
 
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.collections.FlexibleServletAccessor;
@@ -50,7 +51,7 @@
     public static final String module = CallService.class.getName();
     
     protected String serviceName;
-    protected ContextAccessor inMapAcsr;
+    protected ContextAccessor<Map<String, Object>> inMapAcsr;
     protected String includeUserLoginStr;
     protected String breakOnErrorStr;
     protected String errorCode;
@@ -76,18 +77,18 @@
     protected List<ResultToFieldDef> resultToField = FastList.newInstance();
 
     /** the key is the request attribute name, the value is the result name to get */
-    protected Map<FlexibleServletAccessor, ContextAccessor> resultToRequest = FastMap.newInstance();
+    protected Map<FlexibleServletAccessor<Object>, ContextAccessor<Object>> resultToRequest = FastMap.newInstance();
 
     /** the key is the session attribute name, the value is the result name to get */
-    protected Map<FlexibleServletAccessor, ContextAccessor> resultToSession = FastMap.newInstance();
+    protected Map<FlexibleServletAccessor<Object>, ContextAccessor<Object>> resultToSession = FastMap.newInstance();
 
     /** the key is the result entry name, the value is the result name to get */
-    protected Map<ContextAccessor, ContextAccessor> resultToResult = FastMap.newInstance();
+    protected Map<ContextAccessor<Object>, ContextAccessor<Object>> resultToResult = FastMap.newInstance();
 
     public CallService(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
         serviceName = element.getAttribute("service-name");
-        inMapAcsr = new ContextAccessor(element.getAttribute("in-map-name"));
+        inMapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("in-map-name"));
         includeUserLoginStr = element.getAttribute("include-user-login");
         breakOnErrorStr = element.getAttribute("break-on-error");
         errorCode = element.getAttribute("error-code");
@@ -117,61 +118,50 @@
         messageSuffix = new FlexibleMessage(UtilXml.firstChildElement(element, "message-suffix"), "service.message.suffix");
         defaultMessage = new FlexibleMessage(UtilXml.firstChildElement(element, "default-message"), "service.default.message");
 
-        List resultsToMapElements = UtilXml.childElementList(element, "results-to-map");
+        List<? extends Element> resultsToMapElements = UtilXml.childElementList(element, "results-to-map");
         if (resultsToMapElements != null && resultsToMapElements.size() > 0) {
-            Iterator iter = resultsToMapElements.iterator();
-            while (iter.hasNext()) {
-                Element resultsToMapElement = (Element) iter.next();
-
+            for (Element resultsToMapElement: resultsToMapElements) {
                 resultsToMap.add(resultsToMapElement.getAttribute("map-name"));
             }
         }
 
-        List resultToFieldElements = UtilXml.childElementList(element, "result-to-field");
+        List<? extends Element> resultToFieldElements = UtilXml.childElementList(element, "result-to-field");
         if (resultToFieldElements != null && resultToFieldElements.size() > 0) {
-            Iterator iter = resultToFieldElements.iterator();
-            while (iter.hasNext()) {
-                Element resultToFieldElement = (Element) iter.next();
+            for (Element resultToFieldElement: resultToFieldElements) {
                 ResultToFieldDef rtfDef = new ResultToFieldDef();
 
                 rtfDef.resultName = resultToFieldElement.getAttribute("result-name");
-                rtfDef.mapAcsr = new ContextAccessor(resultToFieldElement.getAttribute("map-name"));
-                rtfDef.fieldAcsr = new ContextAccessor(resultToFieldElement.getAttribute("field-name"), rtfDef.resultName);
+                rtfDef.mapAcsr = new ContextAccessor<Map<String, Object>>(resultToFieldElement.getAttribute("map-name"));
+                rtfDef.fieldAcsr = new ContextAccessor<Object>(resultToFieldElement.getAttribute("field-name"), rtfDef.resultName);
 
                 resultToField.add(rtfDef);
             }
         }
 
         // get result-to-request and result-to-session sub-ops
-        List resultToRequestElements = UtilXml.childElementList(element, "result-to-request");
+        List<? extends Element> resultToRequestElements = UtilXml.childElementList(element, "result-to-request");
         if (resultToRequestElements != null && resultToRequestElements.size() > 0) {
-            Iterator iter = resultToRequestElements.iterator();
-            while (iter.hasNext()) {
-                Element resultToRequestElement = (Element) iter.next();
-                FlexibleServletAccessor reqAcsr = new FlexibleServletAccessor(resultToRequestElement.getAttribute("request-name"), resultToRequestElement.getAttribute("result-name"));
-                ContextAccessor resultAcsr = new ContextAccessor(resultToRequestElement.getAttribute("result-name"));
+            for (Element resultToRequestElement: resultToRequestElements) {
+                FlexibleServletAccessor<Object> reqAcsr = new FlexibleServletAccessor<Object>(resultToRequestElement.getAttribute("request-name"), resultToRequestElement.getAttribute("result-name"));
+                ContextAccessor<Object> resultAcsr = new ContextAccessor<Object>(resultToRequestElement.getAttribute("result-name"));
                 resultToRequest.put(reqAcsr, resultAcsr);
             }
         }
 
-        List resultToSessionElements = UtilXml.childElementList(element, "result-to-session");
+        List<? extends Element> resultToSessionElements = UtilXml.childElementList(element, "result-to-session");
         if (resultToSessionElements != null && resultToSessionElements.size() > 0) {
-            Iterator iter = resultToSessionElements.iterator();
-            while (iter.hasNext()) {
-                Element resultToSessionElement = (Element) iter.next();
-                FlexibleServletAccessor sesAcsr = new FlexibleServletAccessor(resultToSessionElement.getAttribute("session-name"), resultToSessionElement.getAttribute("result-name"));
-                ContextAccessor resultAcsr = new ContextAccessor(resultToSessionElement.getAttribute("result-name"));
+            for (Element resultToSessionElement: resultToSessionElements) {
+                FlexibleServletAccessor<Object> sesAcsr = new FlexibleServletAccessor<Object>(resultToSessionElement.getAttribute("session-name"), resultToSessionElement.getAttribute("result-name"));
+                ContextAccessor<Object> resultAcsr = new ContextAccessor<Object>(resultToSessionElement.getAttribute("result-name"));
                 resultToSession.put(sesAcsr, resultAcsr);
             }
         }
 
-        List resultToResultElements = UtilXml.childElementList(element, "result-to-result");
+        List<? extends Element> resultToResultElements = UtilXml.childElementList(element, "result-to-result");
         if (resultToResultElements != null && resultToResultElements.size() > 0) {
-            Iterator iter = resultToResultElements.iterator();
-            while (iter.hasNext()) {
-                Element resultToResultElement = (Element) iter.next();
-                ContextAccessor serResAcsr = new ContextAccessor(resultToResultElement.getAttribute("service-result-name"), resultToResultElement.getAttribute("result-name"));
-                ContextAccessor resultAcsr = new ContextAccessor(resultToResultElement.getAttribute("result-name"));
+            for (Element resultToResultElement: resultToResultElements) {
+                ContextAccessor<Object> serResAcsr = new ContextAccessor<Object>(resultToResultElement.getAttribute("service-result-name"), resultToResultElement.getAttribute("result-name"));
+                ContextAccessor<Object> resultAcsr = new ContextAccessor<Object>(resultToResultElement.getAttribute("result-name"));
                 resultToResult.put(serResAcsr, resultAcsr);
             }
         }
@@ -190,13 +180,13 @@
         String errorCode = methodContext.expandString(this.errorCode);
         String successCode = methodContext.expandString(this.successCode);
 
-        Map inMap = null;
+        Map<String, Object> inMap = null;
         if (inMapAcsr.isEmpty()) {
-            inMap = new HashMap();
+            inMap = FastMap.newInstance();
         } else {
-            inMap = (Map) inMapAcsr.get(methodContext);
+            inMap = inMapAcsr.get(methodContext);
             if (inMap == null) {
-                inMap = new HashMap();
+                inMap = FastMap.newInstance();
                 inMapAcsr.put(methodContext, inMap);
             }
         }
@@ -213,7 +203,7 @@
         }
 
         // invoke the service
-        Map result = null;
+        Map<String, Object> result = null;
 
         // add UserLogin to context if expected
         if (includeUserLogin) {
@@ -259,21 +249,17 @@
         }
 
         if (resultsToMap.size() > 0) {
-            Iterator iter = resultsToMap.iterator();
-            while (iter.hasNext()) {
-                String mapName = (String) iter.next();
-                methodContext.putEnv(mapName, new HashMap(result));
+            for (String mapName: resultsToMap) {
+                methodContext.putEnv(mapName, UtilMisc.makeMapWritable(result));
             }
         }
 
         if (resultToField.size() > 0) {
-            Iterator iter = resultToField.iterator();
-            while (iter.hasNext()) {
-                ResultToFieldDef rtfDef = (ResultToFieldDef) iter.next();
+            for (ResultToFieldDef rtfDef: resultToField) {
                 if (!rtfDef.mapAcsr.isEmpty()) {
-                    Map tempMap = (Map) rtfDef.mapAcsr.get(methodContext);
+                    Map<String, Object> tempMap = rtfDef.mapAcsr.get(methodContext);
                     if (tempMap == null) {
-                        tempMap = new HashMap();
+                        tempMap = FastMap.newInstance();
                         rtfDef.mapAcsr.put(methodContext, tempMap);
                     }
                     rtfDef.fieldAcsr.put(tempMap, result.get(rtfDef.resultName), methodContext);
@@ -286,21 +272,17 @@
         // only run this if it is in an EVENT context
         if (methodContext.getMethodType() == MethodContext.EVENT) {
             if (resultToRequest.size() > 0) {
-                Iterator iter = resultToRequest.entrySet().iterator();
-                while (iter.hasNext()) {
-                    Map.Entry entry = (Map.Entry) iter.next();
-                    FlexibleServletAccessor requestAcsr = (FlexibleServletAccessor) entry.getKey();
-                    ContextAccessor resultAcsr = (ContextAccessor) entry.getValue();
+                for (Map.Entry<FlexibleServletAccessor<Object>, ContextAccessor<Object>> entry: resultToRequest.entrySet()) {
+                    FlexibleServletAccessor<Object> requestAcsr = entry.getKey();
+                    ContextAccessor<Object> resultAcsr = entry.getValue();
                     requestAcsr.put(methodContext.getRequest(), resultAcsr.get(result, methodContext), methodContext.getEnvMap());
                 }
             }
 
             if (resultToSession.size() > 0) {
-                Iterator iter = resultToSession.entrySet().iterator();
-                while (iter.hasNext()) {
-                    Map.Entry entry = (Map.Entry) iter.next();
-                    FlexibleServletAccessor sessionAcsr = (FlexibleServletAccessor) entry.getKey();
-                    ContextAccessor resultAcsr = (ContextAccessor) entry.getValue();
+                for (Map.Entry<FlexibleServletAccessor<Object>, ContextAccessor<Object>> entry: resultToSession.entrySet()) {
+                    FlexibleServletAccessor<Object> sessionAcsr = entry.getKey();
+                    ContextAccessor<Object> resultAcsr = entry.getValue();
                     sessionAcsr.put(methodContext.getRequest().getSession(), resultAcsr.get(result, methodContext), methodContext.getEnvMap());
                 }
             }
@@ -309,11 +291,9 @@
         // only run this if it is in an SERVICE context
         if (methodContext.getMethodType() == MethodContext.SERVICE) {
             if (resultToResult.size() > 0) {
-                Iterator iter = resultToResult.entrySet().iterator();
-                while (iter.hasNext()) {
-                    Map.Entry entry = (Map.Entry) iter.next();
-                    ContextAccessor targetResultAcsr = (ContextAccessor) entry.getKey();
-                    ContextAccessor resultAcsr = (ContextAccessor) entry.getValue();
+                for (Map.Entry<ContextAccessor<Object>, ContextAccessor<Object>> entry: resultToResult.entrySet()) {
+                    ContextAccessor<Object> targetResultAcsr = entry.getKey();
+                    ContextAccessor<Object> resultAcsr = entry.getValue();
                     targetResultAcsr.put(methodContext.getResults(), resultAcsr.get(result, methodContext), methodContext);
                 }
             }
@@ -380,7 +360,7 @@
 
     public static class ResultToFieldDef {
         public String resultName;
-        public ContextAccessor mapAcsr;
-        public ContextAccessor fieldAcsr;
+        public ContextAccessor<Map<String, Object>> mapAcsr;
+        public ContextAccessor<Object> fieldAcsr;
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallServiceAsynch.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallServiceAsynch.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallServiceAsynch.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallServiceAsynch.java Sun Aug  3 20:00:54 2008
@@ -18,10 +18,11 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.callops;
 
-import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
 
+import javolution.util.FastMap;
+
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.minilang.SimpleMethod;
@@ -39,13 +40,13 @@
     public static final String module = CallServiceAsynch.class.getName();
     
     protected String serviceName;
-    protected ContextAccessor inMapAcsr;
+    protected ContextAccessor<Map<String, Object>> inMapAcsr;
     protected String includeUserLoginStr;
 
     public CallServiceAsynch(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
         serviceName = element.getAttribute("service-name");
-        inMapAcsr = new ContextAccessor(element.getAttribute("in-map-name"));
+        inMapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("in-map-name"));
         includeUserLoginStr = element.getAttribute("include-user-login");
     }
 
@@ -53,13 +54,13 @@
         String serviceName = methodContext.expandString(this.serviceName);
         boolean includeUserLogin = !"false".equals(methodContext.expandString(includeUserLoginStr));
         
-        Map inMap = null;
+        Map<String, Object> inMap = null;
         if (inMapAcsr.isEmpty()) {
-            inMap = new HashMap();
+            inMap = FastMap.newInstance();
         } else {
-            inMap = (Map) inMapAcsr.get(methodContext);
+            inMap = inMapAcsr.get(methodContext);
             if (inMap == null) {
-                inMap = new HashMap();
+                inMap = FastMap.newInstance();
                 inMapAcsr.put(methodContext, inMap);
             }
         }



Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> Or have a common, pre-defined test method signature kept in the class
> itself.

Er, no, absolutely not.  Then, that method will be taking up memory at 
runtime.

Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Jacques Le Roux <ja...@les7arts.com>.
I prefer the 1st but this idea of test method signature is interesting too

Jacques

From: "Adrian Crum" <ad...@hlmksw.com>
> Or have a common, pre-defined test method signature kept in the class
> itself.
> 
> -Adrian
> 
> Adam Heath wrote:
>> David Jones wrote:
>>>
>>> Being upset about inadequate automated tests (though actually we
>>  > have hundreds of them) is a good thing, as long as that translates
>>  > into action... ;)
>> 
>> Oh, it'll translate into action, most definately.
>> 
>> I do have a question, tho.  For java-level test cases, would it be 
>> better to have the test code side-by-side with the main classes, or in a 
>> different top-level src tree?  Ie, like this:
>> 
>> src/org/ofbiz/minilang/method/callops/CreateObject.java
>> src/org/ofbiz/minilang/method/callops/tests/CreateObjectTest.java
>> 
>> or:
>> 
>> src/java/org/ofbiz/minilang/method/callops/CreateObject.java
>> src/tests/org/ofbiz/minilang/method/callops/tests/CreateObjectTest.java
>> 
>> I prefer the former, as it keeps the main code closer to it's test code, 
>> so it's easier to discover problems.
>> 
>

Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Adrian Crum <ad...@hlmksw.com>.
Or have a common, pre-defined test method signature kept in the class
itself.

-Adrian

Adam Heath wrote:
> David Jones wrote:
>>
>> Being upset about inadequate automated tests (though actually we
>  > have hundreds of them) is a good thing, as long as that translates
>  > into action... ;)
> 
> Oh, it'll translate into action, most definately.
> 
> I do have a question, tho.  For java-level test cases, would it be 
> better to have the test code side-by-side with the main classes, or in a 
> different top-level src tree?  Ie, like this:
> 
> src/org/ofbiz/minilang/method/callops/CreateObject.java
> src/org/ofbiz/minilang/method/callops/tests/CreateObjectTest.java
> 
> or:
> 
> src/java/org/ofbiz/minilang/method/callops/CreateObject.java
> src/tests/org/ofbiz/minilang/method/callops/tests/CreateObjectTest.java
> 
> I prefer the former, as it keeps the main code closer to it's test code, 
> so it's easier to discover problems.
> 

Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Tim Ruppert <ti...@hotwaxmedia.com>.
I like either one - I normally had them separated like the latter, but  
the former is coolio as well.

Cheers,
Tim
--
Tim Ruppert
HotWax Media
http://www.hotwaxmedia.com

o:801.649.6594
f:801.649.6595


On Aug 4, 2008, at 11:19 AM, Adam Heath wrote:

> David Jones wrote:
>> Being upset about inadequate automated tests (though actually we
> > have hundreds of them) is a good thing, as long as that translates
> > into action... ;)
>
> Oh, it'll translate into action, most definately.
>
> I do have a question, tho.  For java-level test cases, would it be  
> better to have the test code side-by-side with the main classes, or  
> in a different top-level src tree?  Ie, like this:
>
> src/org/ofbiz/minilang/method/callops/CreateObject.java
> src/org/ofbiz/minilang/method/callops/tests/CreateObjectTest.java
>
> or:
>
> src/java/org/ofbiz/minilang/method/callops/CreateObject.java
> src/tests/org/ofbiz/minilang/method/callops/tests/ 
> CreateObjectTest.java
>
> I prefer the former, as it keeps the main code closer to it's test  
> code, so it's easier to discover problems.


Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang:./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by David Jones <jo...@hotwaxmedia.com>.

On Mon, 04 Aug 2008 12:41:52 -0500, Adam Heath <do...@brainfood.com> wrote:
> Adam Heath wrote:
> 
>> src/org/ofbiz/minilang/method/callops/CreateObject.java
>> src/org/ofbiz/minilang/method/callops/tests/CreateObjectTest.java
>>
>> or:
>>
>> src/java/org/ofbiz/minilang/method/callops/CreateObject.java
>> src/tests/org/ofbiz/minilang/method/callops/tests/CreateObjectTest.java
> 
> Of course, renaming everything to fit like the second example is a *lot*
> of churn, which doesn't sit well with me.  For now, I'll probably do it
> as the former, until we still getting tons, then we can revisit it.

Yeah, whatever we do I wouldn't want to move around a bunch of existing source as it causes people lots of problems.

The general direction taken so far is to make sure that tests go in the same component (as much as applicable) as the functionality being tested, but beyond that I guess it depends on how the test is being written and such. If it is in Java then along with the other stuff would be nice, like your first option.

-David




Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Adam Heath <do...@brainfood.com>.
Adam Heath wrote:

> src/org/ofbiz/minilang/method/callops/CreateObject.java
> src/org/ofbiz/minilang/method/callops/tests/CreateObjectTest.java
> 
> or:
> 
> src/java/org/ofbiz/minilang/method/callops/CreateObject.java
> src/tests/org/ofbiz/minilang/method/callops/tests/CreateObjectTest.java

Of course, renaming everything to fit like the second example is a *lot* 
of churn, which doesn't sit well with me.  For now, I'll probably do it 
as the former, until we still getting tons, then we can revisit it.

Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Adam Heath <do...@brainfood.com>.
David Jones wrote:
> 
> Being upset about inadequate automated tests (though actually we
 > have hundreds of them) is a good thing, as long as that translates
 > into action... ;)

Oh, it'll translate into action, most definately.

I do have a question, tho.  For java-level test cases, would it be 
better to have the test code side-by-side with the main classes, or in a 
different top-level src tree?  Ie, like this:

src/org/ofbiz/minilang/method/callops/CreateObject.java
src/org/ofbiz/minilang/method/callops/tests/CreateObjectTest.java

or:

src/java/org/ofbiz/minilang/method/callops/CreateObject.java
src/tests/org/ofbiz/minilang/method/callops/tests/CreateObjectTest.java

I prefer the former, as it keeps the main code closer to it's test code, 
so it's easier to discover problems.

Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by David Jones <jo...@hotwaxmedia.com>.

On Mon, 4 Aug 2008 17:02:56 +0200, Jacopo Cappellato <ja...@gmail.com> wrote:
> 
> On Aug 4, 2008, at 4:49 PM, Adam Heath wrote:
>> Running tests at the top-level, for the entire container, can be
>> painful when one is working on an isolated level.  It needs to be
>> simple to run a tests in smaller chunks.
>>
> 
> I know there is a way to run the tests on a single component, I don't
> remember the syntax, but it should be rather easy to find somewhere
> (Confluence or ML).

There is documentation in the Technical Production Setup Guide (http://docs.ofbiz.org/display/OFBTECH/Apache+OFBiz+Technical+Production+Setup+Guide) in the "Running OFBiz Automated Tests" section. I'm not sure if that's the best place for it, and in fact we should probably move it to the Demo and Test Setup Guide (http://docs.ofbiz.org/display/OFBADMIN/Demo+and+Test+Setup+Guide).

Anyway, it has info about running tests per component, and I think there are even some ways to run more granular tests but I don't remember them off the top of my head.

Fortunately for us we all "read Java" and can look at the test run container implementation to see the options, and add more if we're not satisfied.

Being upset about inadequate automated tests (though actually we have hundreds of them) is a good thing, as long as that translates into action... ;)

-David




Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang:./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by David Jones <jo...@hotwaxmedia.com>.

On Mon, 04 Aug 2008 13:14:47 -0500, Adam Heath <do...@brainfood.com> wrote:
> Jacopo Cappellato wrote:
> 
>> No need to apologize, you are doing a big amount of code changes and
>> issues like this can rather easily be introduced.
> 
> But I'm perfect, a god.  I'm right, you're all wrong.  Now pay me a
> million dollars.

Ah hah! You blew your cover!

We now know you're not a god, because what use does a god have for a million dollars? ;)

-David



Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by BJ Freeman <bj...@free-man.net>.
sounds more like a delusional problem
:D

Adam Heath sent the following on 8/4/2008 11:14 AM:
> Jacopo Cappellato wrote:
> 
>> No need to apologize, you are doing a big amount of code changes and
>> issues like this can rather easily be introduced.
> 
> But I'm perfect, a god.  I'm right, you're all wrong.  Now pay me a
> million dollars.
> 
> :)
> 
> 
> 


Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Adam Heath <do...@brainfood.com>.
Jacopo Cappellato wrote:

> No need to apologize, you are doing a big amount of code changes and 
> issues like this can rather easily be introduced.

But I'm perfect, a god.  I'm right, you're all wrong.  Now pay me a 
million dollars.

:)

Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Jacopo Cappellato <ja...@gmail.com>.
On Aug 4, 2008, at 4:49 PM, Adam Heath wrote:

> Jacopo Cappellato wrote:
>> On Aug 4, 2008, at 4:18 PM, Adam Heath wrote:
>>> Jacopo Cappellato wrote:
>>>> yeah,
>>>> I am getting (and I have reported a few hours ago) a similar  
>>>> error when receiving items into inventory.
>>>> Adam, did you get a chance to test the applications using the  
>>>> framework components you have modified? If they are working for  
>>>> you, then you may have missed to commit a part of your work.
>>>
>>> I did test, but obviously not everything.  It's not possible for a  
>>> human to test every single bit of the code; that's why we need  
>>> more automated tests.
>> I agree it would be great to have more and more automated tests;  
>> however some of the ones that we already have were failing due to  
>> the casting error in the "iterate" operation... I guess you didn't  
>> run them :-)
>
> You're right, I didn't.  Sorry.

No need to apologize, you are doing a big amount of code changes and  
issues like this can rather easily be introduced.
>
> Running tests at the top-level, for the entire container, can be  
> painful when one is working on an isolated level.  It needs to be  
> simple to run a tests in smaller chunks.
>

I know there is a way to run the tests on a single component, I don't  
remember the syntax, but it should be rather easy to find somewhere  
(Confluence or ML).

> On that note, I'm going to start working on junit tests for  
> individual bits of code; minilang will be the first one that I do.   
> I'll get the basic stuff started, then it should be easy for others  
> to see how I'm doing it, and help out with it.

More automatic tests on framework component are welcome (as the ones  
on application level components)!

Jacopo


Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Tim Ruppert <ti...@hotwaxmedia.com>.
+1

On Aug 4, 2008, at 8:49 AM, Adam Heath wrote:

> Jacopo Cappellato wrote:
>> On Aug 4, 2008, at 4:18 PM, Adam Heath wrote:
>>> Jacopo Cappellato wrote:
>>>> yeah,
>>>> I am getting (and I have reported a few hours ago) a similar  
>>>> error when receiving items into inventory.
>>>> Adam, did you get a chance to test the applications using the  
>>>> framework components you have modified? If they are working for  
>>>> you, then you may have missed to commit a part of your work.
>>>
>>> I did test, but obviously not everything.  It's not possible for a  
>>> human to test every single bit of the code; that's why we need  
>>> more automated tests.
>> I agree it would be great to have more and more automated tests;  
>> however some of the ones that we already have were failing due to  
>> the casting error in the "iterate" operation... I guess you didn't  
>> run them :-)
>
> You're right, I didn't.  Sorry.
>
> Running tests at the top-level, for the entire container, can be  
> painful when one is working on an isolated level.  It needs to be  
> simple to run a tests in smaller chunks.
>
> On that note, I'm going to start working on junit tests for  
> individual bits of code; minilang will be the first one that I do.   
> I'll get the basic stuff started, then it should be easy for others  
> to see how I'm doing it, and help out with it.


Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Adam Heath <do...@brainfood.com>.
Jacopo Cappellato wrote:
> 
> On Aug 4, 2008, at 4:18 PM, Adam Heath wrote:
> 
>> Jacopo Cappellato wrote:
>>> yeah,
>>> I am getting (and I have reported a few hours ago) a similar error 
>>> when receiving items into inventory.
>>> Adam, did you get a chance to test the applications using the 
>>> framework components you have modified? If they are working for you, 
>>> then you may have missed to commit a part of your work.
>>
>> I did test, but obviously not everything.  It's not possible for a 
>> human to test every single bit of the code; that's why we need more 
>> automated tests.
> 
> I agree it would be great to have more and more automated tests; however 
> some of the ones that we already have were failing due to the casting 
> error in the "iterate" operation... I guess you didn't run them :-)

You're right, I didn't.  Sorry.

Running tests at the top-level, for the entire container, can be painful 
when one is working on an isolated level.  It needs to be simple to run 
a tests in smaller chunks.

On that note, I'm going to start working on junit tests for individual 
bits of code; minilang will be the first one that I do.  I'll get the 
basic stuff started, then it should be easy for others to see how I'm 
doing it, and help out with it.

Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Jacopo Cappellato <ja...@gmail.com>.
On Aug 4, 2008, at 4:18 PM, Adam Heath wrote:

> Jacopo Cappellato wrote:
>> yeah,
>> I am getting (and I have reported a few hours ago) a similar error  
>> when receiving items into inventory.
>> Adam, did you get a chance to test the applications using the  
>> framework components you have modified? If they are working for  
>> you, then you may have missed to commit a part of your work.
>
> I did test, but obviously not everything.  It's not possible for a  
> human to test every single bit of the code; that's why we need more  
> automated tests.

I agree it would be great to have more and more automated tests;  
however some of the ones that we already have were failing due to the  
casting error in the "iterate" operation... I guess you didn't run  
them :-)

Jacopo

>
>
> As for minilang, that is something that can have a rather large and  
> thorough set of test cases.
>
> This problem is fixed in 682395.


Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Adam Heath <do...@brainfood.com>.
Jacopo Cappellato wrote:
> yeah,
> 
> I am getting (and I have reported a few hours ago) a similar error when 
> receiving items into inventory.
> 
> Adam, did you get a chance to test the applications using the framework 
> components you have modified? If they are working for you, then you may 
> have missed to commit a part of your work.

I did test, but obviously not everything.  It's not possible for a human 
to test every single bit of the code; that's why we need more automated 
tests.

As for minilang, that is something that can have a rather large and 
thorough set of test cases.

This problem is fixed in 682395.

Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Jacopo Cappellato <ja...@gmail.com>.
yeah,

I am getting (and I have reported a few hours ago) a similar error  
when receiving items into inventory.

Adam, did you get a chance to test the applications using the  
framework components you have modified? If they are working for you,  
then you may have missed to commit a part of your work.

Jacopo

On Aug 4, 2008, at 1:25 PM, Bilgin Ibryam wrote:

> After these changes I get java.lang.ClassCastException during order  
> creation.
> Here is the error message:
>
> 2008-08-04 14:24:37,794 (http-0.0.0.0-8443-1)  
> [       SimpleMethod.java:1100:ERROR]
>     [java] ---- runtime exception report  
> --------------------------------------------------
>     [java] Error in simple-method operation [<iterate list- 
> name="relatedPartyIdList" entry-name="relatedPartyId"/>]:  
> java.lang.ClassCastException: java.lang.String
>     [java] Exception: java.lang.ClassCastException
>     [java] Message: java.lang.String
>     [java] ---- stack trace  
> ---------------------------------------------------------------
>     [java] java.lang.ClassCastException: java.lang.String
>     [java]  
> org.ofbiz.minilang.method.envops.Iterate.exec(Iterate.java:107)
>     [java]  
> org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java:1095)
>     [java] org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:735)
>     [java]  
> org 
> .ofbiz 
> .minilang.method.callops.CallSimpleMethod.exec(CallSimpleMethod.java: 
> 75)
>     [java]  
> org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java:1095)
>     [java] org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:735)
>     [java]  
> org 
> .ofbiz 
> .minilang.method.callops.CallSimpleMethod.exec(CallSimpleMethod.java: 
> 75)
>     [java]  
> org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java:1095)
>     [java] org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:735)
>     [java]  
> org.ofbiz.minilang.SimpleMethod.runSimpleMethod(SimpleMethod.java:135)
>     [java]  
> org.ofbiz.minilang.SimpleMethod.runSimpleService(SimpleMethod.java: 
> 117)
>     [java]  
> org 
> .ofbiz 
> .minilang 
> .SimpleServiceEngine.serviceInvoker(SimpleServiceEngine.java:76)
>     [java]  
> org 
> .ofbiz.minilang.SimpleServiceEngine.runSync(SimpleServiceEngine.java: 
> 51)
>     [java]  
> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java: 
> 384)
>     [java]  
> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java: 
> 213)
>     [java]  
> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java: 
> 149)
>     [java]  
> org 
> .ofbiz 
> .accounting 
> .payment 
> .BillingAccountWorker 
> .makePartyBillingAccountList(BillingAccountWorker.java:72)
>     [java] sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     [java]  
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     [java]  
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
>     [java] java.lang.reflect.Method.invoke(Method.java:585)
>     [java]  
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java: 
> 86)
>     [java] groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
>     [java]  
> groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1105)
>     [java]  
> org 
> .codehaus 
> .groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:749)
>     [java]  
> org 
> .codehaus 
> .groovy 
> .runtime 
> .ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
>     [java] CheckoutPayment.run(CheckoutPayment.groovy:54)
>     [java]  
> org.ofbiz.base.util.GroovyUtil.runScriptAtLocation(GroovyUtil.java:78)
>     [java] org.ofbiz.widget.screen.ModelScreenAction 
> $Script.runAction(ModelScreenAction.java:400)
>     [java]  
> org 
> .ofbiz 
> .widget 
> .screen.ModelScreenAction.runSubActions(ModelScreenAction.java:122)
>     [java] org.ofbiz.widget.screen.ModelScreenWidget 
> $Section.renderWidgetString(ModelScreenWidget.java:221)
>     [java]  
> org 
> .ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java: 
> 393)
>     [java]  
> org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:129)
>     [java]  
> org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:92)
>     [java]  
> org 
> .ofbiz 
> .widget 
> .screen.ScreenWidgetViewHandler.render(ScreenWidgetViewHandler.java: 
> 96)
>     [java]  
> org 
> .ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java: 
> 640)
>     [java]  
> org 
> .ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java: 
> 425)
>     [java]  
> org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:198)
>     [java] javax.servlet.http.HttpServlet.service(HttpServlet.java: 
> 690)
>     [java] javax.servlet.http.HttpServlet.service(HttpServlet.java: 
> 803)
>     [java]  
> org 
> .apache 
> .catalina 
> .core 
> .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 
> 290)
>     [java]  
> org 
> .apache 
> .catalina 
> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>     [java]  
> org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java: 
> 259)
>     [java]  
> org 
> .apache 
> .catalina 
> .core 
> .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 
> 235)
>     [java]  
> org 
> .apache 
> .catalina 
> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>     [java]  
> org 
> .apache 
> .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 
> 233)
>     [java]  
> org 
> .apache 
> .catalina.core.StandardContextValve.invoke(StandardContextValve.java: 
> 175)
>     [java]  
> org 
> .apache 
> .catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>     [java]  
> org 
> .apache 
> .catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>     [java]  
> org 
> .apache 
> .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java: 
> 109)
>     [java]  
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java: 
> 568)
>     [java]  
> org 
> .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 
> 286)
>     [java]  
> org 
> .apache.coyote.http11.Http11Processor.process(Http11Processor.java: 
> 844)
>     [java] org.apache.coyote.http11.Http11Protocol 
> $Http11ConnectionHandler.process(Http11Protocol.java:583)
>     [java] org.apache.tomcat.util.net.JIoEndpoint 
> $Worker.run(JIoEndpoint.java:447)
>     [java] java.lang.Thread.run(Thread.java:595)
>


Re: svn commit: r682246 [1/4] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Posted by Bilgin Ibryam <bi...@iguanait.com>.
After these changes I get java.lang.ClassCastException during order creation.
Here is the error message:

2008-08-04 14:24:37,794 (http-0.0.0.0-8443-1) [       SimpleMethod.java:1100:ERROR] 
     [java] ---- runtime exception report --------------------------------------------------
     [java] Error in simple-method operation [<iterate list-name="relatedPartyIdList" entry-name="relatedPartyId"/>]: java.lang.ClassCastException: java.lang.String
     [java] Exception: java.lang.ClassCastException
     [java] Message: java.lang.String
     [java] ---- stack trace ---------------------------------------------------------------
     [java] java.lang.ClassCastException: java.lang.String
     [java] org.ofbiz.minilang.method.envops.Iterate.exec(Iterate.java:107)
     [java] org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java:1095)
     [java] org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:735)
     [java] org.ofbiz.minilang.method.callops.CallSimpleMethod.exec(CallSimpleMethod.java:75)
     [java] org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java:1095)
     [java] org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:735)
     [java] org.ofbiz.minilang.method.callops.CallSimpleMethod.exec(CallSimpleMethod.java:75)
     [java] org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java:1095)
     [java] org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:735)
     [java] org.ofbiz.minilang.SimpleMethod.runSimpleMethod(SimpleMethod.java:135)
     [java] org.ofbiz.minilang.SimpleMethod.runSimpleService(SimpleMethod.java:117)
     [java] org.ofbiz.minilang.SimpleServiceEngine.serviceInvoker(SimpleServiceEngine.java:76)
     [java] org.ofbiz.minilang.SimpleServiceEngine.runSync(SimpleServiceEngine.java:51)
     [java] org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:384)
     [java] org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:213)
     [java] org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:149)
     [java] org.ofbiz.accounting.payment.BillingAccountWorker.makePartyBillingAccountList(BillingAccountWorker.java:72)
     [java] sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java] sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java] java.lang.reflect.Method.invoke(Method.java:585)
     [java] org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
     [java] groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
     [java] groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1105)
     [java] org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:749)
     [java] org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
     [java] CheckoutPayment.run(CheckoutPayment.groovy:54)
     [java] org.ofbiz.base.util.GroovyUtil.runScriptAtLocation(GroovyUtil.java:78)
     [java] org.ofbiz.widget.screen.ModelScreenAction$Script.runAction(ModelScreenAction.java:400)
     [java] org.ofbiz.widget.screen.ModelScreenAction.runSubActions(ModelScreenAction.java:122)
     [java] org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:221)
     [java] org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:393)
     [java] org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:129)
     [java] org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:92)
     [java] org.ofbiz.widget.screen.ScreenWidgetViewHandler.render(ScreenWidgetViewHandler.java:96)
     [java] org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:640)
     [java] org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:425)
     [java] org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:198)
     [java] javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
     [java] javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
     [java] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
     [java] org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     [java] org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:259)
     [java] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
     [java] org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     [java] org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
     [java] org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
     [java] org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
     [java] org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
     [java] org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     [java] org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
     [java] org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
     [java] org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
     [java] org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
     [java] org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
     [java] java.lang.Thread.run(Thread.java:595)