Author: keith
Date: Wed Apr 30 07:53:02 2008
New Revision: 16400

Log:

Adding support for system.wwwURL. We had to do some changes to the JS 
MessageReceiver too cause we had to pass in the serviceName. 


Modified:
   trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java
   
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/system/FunctionSchedulingJob.java
   
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java
==============================================================================
--- trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java   
(original)
+++ trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java   
Wed Apr 30 07:53:02 2008
@@ -261,6 +261,9 @@
         ServerManager serverManager = ServerManager.getInstance();
         ConfigurationContext configContext = serverManager.configContext;
         AxisService service = 
configContext.getAxisConfiguration().getService(serviceName);
+        if (service == null) {
+            return false;
+        }
         String value = (String) 
service.getParameterValue(ServerConstants.SERVICE_TYPE);
         return MashupConstants.MASHUP_JS_SERVICE.equals(value) ||
                 ServerConstants.SERVICE_TYPE_DB.equals(value);

Modified: 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/system/FunctionSchedulingJob.java
==============================================================================
--- 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/system/FunctionSchedulingJob.java
     (original)
+++ 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/system/FunctionSchedulingJob.java
     Wed Apr 30 07:53:02 2008
@@ -17,7 +17,6 @@
 
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.Parameter;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.mozilla.javascript.Context;
 import org.mozilla.javascript.Function;
@@ -27,6 +26,7 @@
 import org.wso2.javascript.rhino.JavaScriptEngine;
 import org.wso2.javascript.rhino.JavaScriptEngineConstants;
 import org.wso2.javascript.rhino.JavaScriptEngineUtils;
+import org.wso2.mashup.MashupConstants;
 import org.wso2.mashup.utils.MashupUtils;
 import org.wso2.wsas.ServerManager;
 
@@ -50,8 +50,9 @@
             Object jsFunction = 
jobExecutionContext.getJobDetail().getJobDataMap()
                     .get(FunctionSchedulingJob.JAVASCRIPT_FUNCTION);
 
+            String serviceName = axisServce.getName();
             JavaScriptEngine jsEngine =
-                    new JavaScriptEngine(axisServce.getName());
+                    new JavaScriptEngine(serviceName);
 
             // Rhino E4X XMLLibImpl object can be instantiated only from 
within a script
             // So we instantiate it in here, so that we can use it outside of 
the script later
@@ -81,7 +82,7 @@
 
             AxisConfiguration axisConfig = configurationContext.
                     getAxisConfiguration();
-            JavaScriptEngineUtils.loadGlobalPropertyObjects(jsEngine, 
axisConfig);
+            JavaScriptEngineUtils.loadGlobalPropertyObjects(jsEngine, 
axisConfig, serviceName);
 
             URL repoURL = axisConfig.getRepository();
             if (repoURL != null) {

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 30 07:53:02 2008
@@ -409,7 +409,7 @@
             // Load the Global JavaScriptHostObjects that are spefified using 
the parameter
             // <parameter name="javascript.global.propertyobjects"> in the 
axis2.xml
             JavaScriptEngineUtils.loadGlobalPropertyObjects(engine, configCtx
-                    .getAxisConfiguration());
+                    .getAxisConfiguration(), MashupConstants.EMPTY_STRING);
 
             FileInputStream fileInputStream;
             fileInputStream = new FileInputStream(file);
@@ -614,6 +614,9 @@
             }
         } else {
             if (init != null) {
+                JavaScriptEngineUtils
+                                    .loadGlobalPropertyObjects(engine, 
axisConfig,
+                                                               
axisService.getName());
                 init.call(engine.getCx(), engine, engine, new Object[0]);
             }
             // Check weather we need to call the init functions of any services
@@ -653,7 +656,7 @@
                             // parameter
                             // <parameter 
name="javascript.global.propertyobjects"> in the axis2.xml
                             JavaScriptEngineUtils
-                                    .loadGlobalPropertyObjects(engine, 
axisConfig);
+                                    .loadGlobalPropertyObjects(engine, 
axisConfig, serviceName);
 
                             URL repoURL = axisConfig.getRepository();
                             if (repoURL != null) {

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

Reply via email to