You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2006/11/24 08:32:08 UTC

svn commit: r478789 - /incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp

Author: jsdelfino
Date: Thu Nov 23 23:32:07 2006
New Revision: 478789

URL: http://svn.apache.org/viewvc?view=rev&rev=478789
Log:
Changed Web Service binding to use SCARuntime instead of TuscanyRuntime

Modified:
    incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp

Modified: incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp?view=diff&rev=478789&r1=478788&r2=478789
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp Thu Nov 23 23:32:07 2006
@@ -51,7 +51,6 @@
 #include "tuscany/sca/model/WSDLOperation.h"
 #include "tuscany/sca/model/WSDLInterface.h" 
 #include "tuscany/sca/model/Interface.h" 
-#include "tuscany/sca/core/TuscanyRuntime.h"
 #include "tuscany/sca/core/SCARuntime.h"
 #include "tuscany/sca/util/Utils.h"
 #include "Axis2Utils.h"
@@ -131,17 +130,16 @@
     return AXIS2_SUCCESS; 
 }
 
-/**
- * Initialize the Tuscany runtime
- */
  
-static string systemRoot = "";
-static string componentName = "";
-static string serviceName = "";
-static TuscanyRuntime* tuscanyRuntime = NULL;
+static SCARuntime* scaRuntime = NULL;
 static CompositeService* compositeService = NULL;
 
-void initTuscanyRuntime(const axis2_env_t *env, const char* root, const char *component, const char* service)
+static string serviceName = "";
+
+/**
+ * Initialize the SCA runtime
+ */
+static void initializeSCARuntime(const char* root, const char *component, const char* service)
 {
     logentry();
     loginfo("Root: %s, component: %s, service: %s", root, component, service);
@@ -152,6 +150,7 @@
         bool restart = false;
         bool resolve = false;
 
+        string systemRoot = SCARuntime::getSystemRoot();
         if (systemRoot != root)
         {
             systemRoot = root;
@@ -159,6 +158,7 @@
             resolve = true;
         }
 
+        string componentName = SCARuntime::getDefaultComponentName();
         if (componentName != component)
         {
             componentName = component;
@@ -171,33 +171,37 @@
             resolve = true;
         }
         
-        if (tuscanyRuntime == NULL)
+        if (scaRuntime == NULL)
         {
-            loginfo("Creating new Tuscany runtime");
-            tuscanyRuntime = new TuscanyRuntime(componentName, systemRoot);
-            tuscanyRuntime->start();
+            loginfo("Creating new SCA runtime");
+            SCARuntime::setSystemRoot(systemRoot);
+            SCARuntime::setSystemPath("");
+            SCARuntime::setDefaultComponentName(componentName);
+            scaRuntime = SCARuntime::getInstance();
         }
         else if (restart)
         {
-            loginfo("Restarting Tuscany runtime");
-            tuscanyRuntime->stop();
-            tuscanyRuntime->setDefaultComponentName(componentName);
-            tuscanyRuntime->setSystemRoot(systemRoot);
-            tuscanyRuntime->start();
+            loginfo("Restarting SCA runtime");
+            SCARuntime::releaseInstance();
+            SCARuntime::setSystemRoot(systemRoot);
+            SCARuntime::setSystemPath("");
+            SCARuntime::setDefaultComponentName(componentName);
+            scaRuntime = SCARuntime::getInstance();
         }
         else if (resolve)
         {
-            loginfo("Refreshing Tuscany runtime");
-            tuscanyRuntime->stop();
-            tuscanyRuntime->setDefaultComponentName(componentName);
-            tuscanyRuntime->setSystemRoot(systemRoot);
-            tuscanyRuntime->start();
+            loginfo("Refreshing SCA runtime");
+            SCARuntime::releaseInstance();
+            SCARuntime::setSystemRoot(systemRoot);
+            SCARuntime::setSystemPath("");
+            SCARuntime::setDefaultComponentName(componentName);
+            scaRuntime = SCARuntime::getInstance();
         }
 
         if (compositeService == NULL)
         {
             loginfo("Resolving composite: %s, service: %s", componentName.c_str(), serviceName.c_str());
-            Component* component = SCARuntime::getInstance()->getDefaultComponent();
+            Component* component = scaRuntime->getDefaultComponent();
             if (component == NULL)
             {
                 string msg = "Component not found " + componentName;
@@ -216,7 +220,7 @@
             if (resolve)
             {
                 loginfo("Switching to composite: %s, service: %s", componentName.c_str(), serviceName.c_str());
-                Component* component = SCARuntime::getInstance()->getDefaultComponent();
+                Component* component = scaRuntime->getDefaultComponent();
                 if (component == NULL)
                 {
                     string msg = "Component not found " + componentName;
@@ -238,7 +242,7 @@
     }
     catch(TuscanyRuntimeException &ex)
     {
-        logerror("Failed to initialize Tuscany runtime: %s", (const char*)ex);
+        logerror("Failed to initialize SCA runtime: %s", (const char*)ex);
         throw;
     }  
 }
@@ -310,7 +314,7 @@
                             string component, service;
                             Utils::rTokeniseString("/", serviceParam, component, service);
                     
-                            initTuscanyRuntime(env, rootParam, component.c_str(), service.c_str());
+                            initializeSCARuntime(rootParam, component.c_str(), service.c_str());
                         }
                         else {
                             
@@ -347,19 +351,19 @@
                             loginfo("System root: %s, component name: %s, service name: %s, operation name: %s",
                                 rootParam, component.c_str(), service.c_str(), op_name.c_str());
                             
-                            initTuscanyRuntime(env, rootParam, component.c_str(), service.c_str());
+                            initializeSCARuntime(rootParam, component.c_str(), service.c_str());
                         }
     
                         if(!compositeService)
                         {
-                   		    logerror("Failed to initialize Tuscany runtime, could not initialize CompositeService");
+                   		    logerror("Failed to initialize SCA runtime, could not initialize CompositeService");
                             return 0;
                         }
     
                         DataFactoryPtr dataFactory = compositeService->getComposite()->getDataFactory();
                         if (dataFactory == 0)
                         {
-                            logerror("Failed to initialize Tuscany runtime, could not get DataFactory");
+                            logerror("Failed to initialize SCA runtime, could not get DataFactory");
                             return 0;
                         }
     



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org