Author: keith
Date: Wed Apr  2 07:56:17 2008
New Revision: 15493

Log:

Fixing Mashup-744



Modified:
   
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java

Modified: 
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
==============================================================================
--- 
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
   (original)
+++ 
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
   Wed Apr  2 07:56:17 2008
@@ -533,9 +533,16 @@
                                   Function function, SchemaGenerator 
schemaGenerator,
                                   String targetNamespace, String serviceName)
             throws AxisFault {
+
+        Scriptable scriptable = function;
+        String funcName = (String) scriptable.get("name", scriptable);
+        String oriMethodName = method;
+        if (funcName != null && !method.equals(funcName)) {
+            method = funcName;
+        }
+
         JavaScriptOperationsAnnotationParser annotationParser =
-                new JavaScriptOperationsAnnotationParser(
-                        function, method);
+                new JavaScriptOperationsAnnotationParser(function, method);
         String schemaTargetNamespace = 
schemaGenerator.getSchemaTargetNamespace();
         if (annotationParser.isVisible()) {
 
@@ -548,10 +555,9 @@
                         "function with the name (or a function containing the 
operationNmae " +
                         "annotation as) " + name + " already exists. ");
             }
-
-            String sourceStr = "function convertToString(){ " + "var code = " 
+ method
-                    + ".toString();" + "return code;}";
-            engine.getCx().evaluateString(engine, sourceStr, "", 0, null);
+            String sourceStr = "function convertToString(){ " + "var code = " 
+ oriMethodName
+                            + ".toString();" + "return code;}";
+                    engine.getCx().evaluateString(engine, sourceStr, "", 0, 
null);
 
             // Get the function from the scope the javascript object is in
             Object fObj = engine.get("convertToString", engine);
@@ -639,7 +645,7 @@
             axisOp.setDocumentation(annotationParser.getDocumentation());
 
             Parameter jsFunctionNameParamter = new Parameter(
-                    JavaScriptEngineConstants.JS_FUNCTION_NAME, method);
+                    JavaScriptEngineConstants.JS_FUNCTION_NAME, oriMethodName);
             axisOp.addParameter(jsFunctionNameParamter);
 
 

_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to