[mashup-dev] svn commit r4607 - in trunk/mashup/java/modules/coreservices/servicesharinghelper/src: META-INF org/wso2/mashup/coreservices/servicesharinghelper

svn at wso2.org svn at wso2.org
Sun Jul 1 22:40:12 PDT 2007


Author: thilina
Date: Sun Jul  1 22:39:45 2007
New Revision: 4607

Modified:
   trunk/mashup/java/modules/coreservices/servicesharinghelper/src/META-INF/services.xml
   trunk/mashup/java/modules/coreservices/servicesharinghelper/src/org/wso2/mashup/coreservices/servicesharinghelper/ServiceSharingHelper.java
Log:
adding the mashup download UI helper operation

Modified: trunk/mashup/java/modules/coreservices/servicesharinghelper/src/META-INF/services.xml
==============================================================================
--- trunk/mashup/java/modules/coreservices/servicesharinghelper/src/META-INF/services.xml	(original)
+++ trunk/mashup/java/modules/coreservices/servicesharinghelper/src/META-INF/services.xml	Sun Jul  1 22:39:45 2007
@@ -1,7 +1,7 @@
 <service name="ServiceSharingHelper" scope="application">
 
     <description>
-        Fascilitates the sharing of mashups between servers
+        Admin service used by the admin consolde to support the sharing of mashups between servers.
     </description>
 
     <messageReceivers>

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	Sun Jul  1 22:39:45 2007
@@ -20,6 +20,7 @@
 
 import javax.activation.DataHandler;
 
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisService;
@@ -58,6 +59,28 @@
         masshupArchiveManupulator.uploadMashupService(destinationServerAddress, dataHandler,
                 configContext, serviceJS.getName(), axisService.getName());
         success = true;
+        //TODO: do we really need the following
         return new Boolean(success);
     }
+    
+    /**
+     * Downloads a service from a remote Mashup server to this Mashup server.
+     * @param remoteServer - Remote sever which has the downloadable service
+     * @param serviceName of the downloadable service
+     * @return
+     * @throws IOException
+     */
+    public Boolean downloadService(String remoteServer, String serviceName) throws IOException {
+        MessageContext messageContext = MessageContext.getCurrentMessageContext();
+        AxisConfiguration axisConfiguration = messageContext.getConfigurationContext()
+                .getAxisConfiguration();
+        //Check whether a service with the given name is already present
+        if (axisConfiguration.getService(serviceName) != null) {
+            throw new AxisFault(
+                    "A Service with a same name already exists in the remote Mashup Server.");
+        }
+        MashupArchiveManupulator archiveManupulator = new MashupArchiveManupulator();
+        archiveManupulator.downloadMashupService(remoteServer, serviceName, messageContext, axisConfiguration);
+        return Boolean.TRUE;
+    }
 }




More information about the Mashup-dev mailing list