Author: keith
Date: Tue Mar 25 07:48:27 2008
New Revision: 15085
Log:
Fixing sharing for DataServices
Modified:
trunk/mashup/java/modules/coreservices/servicesharinghelper/src/org/wso2/mashup/coreservices/servicesharinghelper/ServiceSharingHelper.java
Modified:
trunk/mashup/java/modules/coreservices/servicesharinghelper/src/org/wso2/mashup/coreservices/servicesharinghelper/ServiceSharingHelper.java
==============================================================================
---
trunk/mashup/java/modules/coreservices/servicesharinghelper/src/org/wso2/mashup/coreservices/servicesharinghelper/ServiceSharingHelper.java
(original)
+++
trunk/mashup/java/modules/coreservices/servicesharinghelper/src/org/wso2/mashup/coreservices/servicesharinghelper/ServiceSharingHelper.java
Tue Mar 25 07:48:27 2008
@@ -15,21 +15,19 @@
*/
package org.wso2.mashup.coreservices.servicesharinghelper;
-import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.transport.http.util.URIEncoderDecoder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.javascript.rhino.JavaScriptEngineConstants;
import org.wso2.mashup.MashupConstants;
import org.wso2.mashup.MashupFault;
import org.wso2.mashup.utils.MashupArchiveManupulator;
-import org.wso2.mashup.utils.MashupUtils;
-
+import org.wso2.ws.dataservice.DBConstants;
+import org.wso2.wsas.ServerConstants;
import org.wso2.wsas.admin.service.GlobalAdmin;
import javax.activation.DataHandler;
@@ -51,6 +49,7 @@
String destinationServerAddress, String
overwriteExisting)
throws IOException {
boolean success;
+ File serviceFile = null;
MessageContext currentMessageContext =
MessageContext.getCurrentMessageContext();
AxisConfiguration configuration =
currentMessageContext.getAxisService()
@@ -71,17 +70,27 @@
DataHandler dataHandler =
masshupArchiveManupulator.createMashupArchiveDataHandler(
axisService, configContext);
- Parameter serviceJSParameter = axisService
- .getParameter(JavaScriptEngineConstants.SERVICE_JS);
- // We do not need to check for Null or whether this is a file as we
- // have already checked it inside the createMashupArchiveDataHandler
- // method.
- File serviceJS = (File) serviceJSParameter.getValue();
+ String value = (String)
axisService.getParameterValue(ServerConstants.SERVICE_TYPE);
+ if (MashupConstants.MASHUP_JS_SERVICE.equals(value)) {
+ Parameter serviceJSParameter = axisService
+ .getParameter(JavaScriptEngineConstants.SERVICE_JS);
+ // We do not need to check for Null or whether this is a file as we
+ // have already checked it inside the
createMashupArchiveDataHandler
+ // method.
+ serviceFile = (File) serviceJSParameter.getValue();
+ } else {
+ Parameter serviceJSParameter = axisService
+ .getParameter(DBConstants.DB_SERVICE_CONFIG_FILE);
+ // We do not need to check for Null or whether this is a file as we
+ // have already checked it inside the
createMashupArchiveDataHandler
+ // method.
+ serviceFile = new File((String) serviceJSParameter.getValue());
+ }
String shortServiceName =
serviceName.substring(serviceName.indexOf(MashupConstants.SEPARATOR_CHAR) + 1);
masshupArchiveManupulator.uploadMashupService(destinationServerAddress,
dataHandler,
- configContext,
serviceJS.getName(),
+ configContext,
serviceFile.getName(),
shortServiceName,
username, password, overwriteExisting);
log
.info("Shared Service \'" + serviceName + "' to the
destination server"
@@ -95,6 +104,7 @@
String destinationServerAddress, String
overwriteExisting)
throws IOException {
boolean success;
+ File serviceFile = null;
MessageContext currentMessageContext =
MessageContext.getCurrentMessageContext();
AxisConfiguration configuration =
currentMessageContext.getAxisService()
@@ -115,17 +125,27 @@
DataHandler dataHandler =
masshupArchiveManupulator.createMashupArchiveDataHandler(
axisService, configContext);
- Parameter serviceJSParameter = axisService
- .getParameter(JavaScriptEngineConstants.SERVICE_JS);
- // We do not need to check for Null or whether this is a file as we
- // have already checked it inside the createMashupArchiveDataHandler
- // method.
- File serviceJS = (File) serviceJSParameter.getValue();
+ String value = (String)
axisService.getParameterValue(ServerConstants.SERVICE_TYPE);
+ if (MashupConstants.MASHUP_JS_SERVICE.equals(value)) {
+ Parameter serviceJSParameter = axisService
+ .getParameter(JavaScriptEngineConstants.SERVICE_JS);
+ // We do not need to check for Null or whether this is a file as we
+ // have already checked it inside the
createMashupArchiveDataHandler
+ // method.
+ serviceFile = (File) serviceJSParameter.getValue();
+ } else {
+ Parameter serviceJSParameter = axisService
+ .getParameter(DBConstants.DB_SERVICE_CONFIG_FILE);
+ // We do not need to check for Null or whether this is a file as we
+ // have already checked it inside the
createMashupArchiveDataHandler
+ // method.
+ serviceFile = new File((String) serviceJSParameter.getValue());
+ }
String shortServiceName =
serviceName.substring(serviceName.indexOf(MashupConstants.SEPARATOR_CHAR) + 1);
masshupArchiveManupulator.uploadMashupService(destinationServerAddress,
dataHandler,
- configContext,
serviceJS.getName(),
+ configContext,
serviceFile.getName(),
shortServiceName,
infoCardToken, overwriteExisting);
log
.info("Shared Service \'" + serviceName + "' to the
destination server"
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev