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/23 20:23:33 UTC
svn commit: r478646 - in
/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/core:
SCARuntime.cpp SCARuntime.h
Author: jsdelfino
Date: Thu Nov 23 11:23:30 2006
New Revision: 478646
URL: http://svn.apache.org/viewvc?view=rev&rev=478646
Log:
Minor changes to make SCARuntime usable by server side bindings. Added static getter methods to the existing setter methods to allow bindings to get the current runtime configuration info. Added a method to set the runtime install directory instead of just depending on an environment variable, to allow it to be configured in httpd.conf with an HTTPD configuration command.
Modified:
incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp
incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h
Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp?view=diff&rev=478646&r1=478645&r2=478646
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp Thu Nov 23 11:23:30 2006
@@ -51,6 +51,7 @@
// Initialize static class member to not pointing at anything
// ==========================================================
SCARuntime* SCARuntime::instance = 0;
+ string SCARuntime::installRoot = "";
string SCARuntime::systemRoot = "";
string SCARuntime::systemPath = "";
string SCARuntime::defaultComponentName = "";
@@ -67,6 +68,14 @@
}
// ==========================================================
+ // Returns the system configuration root
+ // ==========================================================
+ const string& SCARuntime::getSystemRoot()
+ {
+ return systemRoot;
+ }
+
+ // ==========================================================
// Set the system configuration root
// ==========================================================
void SCARuntime::setSystemPath(const string& path)
@@ -77,6 +86,14 @@
}
// ==========================================================
+ // Set the system configuration root
+ // ==========================================================
+ const string& SCARuntime::getSystemPath()
+ {
+ return systemPath;
+ }
+
+ // ==========================================================
// Set the default component name
// ==========================================================
void SCARuntime::setDefaultComponentName(const string& componentName)
@@ -86,6 +103,32 @@
loginfo("Default component name: %s", componentName.c_str());
}
+ // ==========================================================
+ // Returns the default component name
+ // ==========================================================
+ const string& SCARuntime::getDefaultComponentName()
+ {
+ return defaultComponentName ;
+ }
+
+ // ==========================================================
+ // Set the install root
+ // ==========================================================
+ void SCARuntime::setInstallRoot(const string& root)
+ {
+ logentry();
+ installRoot = root;
+ loginfo("SCA runtime install root: %s", installRoot.c_str());
+ }
+
+ // ==========================================================
+ // Returns the install root
+ // ==========================================================
+ const string& SCARuntime::getInstallRoot()
+ {
+ return installRoot;
+ }
+
// ===================================================================
// Constructor for the SCARuntime class. This will be a singleton that
// holds all the information about the current runtime.
@@ -93,21 +136,6 @@
SCARuntime::SCARuntime() : system(0), defaultComponent(0)
{
logentry();
-
- // Locate the SCA install root
- char* root = 0;
- root = getenv(TUSCANY_SCACPP);
- if (root == 0)
- {
- string msg = TUSCANY_SCACPP;
- msg += " environment variable not set";
- throwException(SystemConfigurationException, msg.c_str());
- }
- else
- {
- SCARoot = root;
- }
-
}
// ===================================================================
@@ -134,11 +162,23 @@
if (instance == NULL)
{
- instance = new SCARuntime();
-
- // load extensions
- instance->loadExtensions();
-
+ if (installRoot == "")
+ {
+ // Get install dir from environment variable TUSCANY_SCACPP
+ const char* root = getenv(TUSCANY_SCACPP);
+ if (root != NULL)
+ {
+ loginfo("SCA runtime install root: %s", root);
+ installRoot = root;
+ }
+ else
+ {
+ string msg = TUSCANY_SCACPP;
+ msg += " environment variable not set";
+ throwException(SystemConfigurationException, msg.c_str());
+ }
+ }
+
if (systemRoot == "")
{
// Get root from environment variable TUSCANY_SCACPP_ROOT
@@ -155,6 +195,7 @@
throwException(SystemConfigurationException, msg.c_str());
}
+ loginfo("System root: %s", systemRootEnv);
systemRoot = systemRootEnv;
}
if (systemPath == "")
@@ -164,9 +205,17 @@
char* systemPathEnv = getenv(TUSCANY_SCACPP_PATH);
if (systemPathEnv != 0)
{
+ loginfo("System path: %s", systemPathEnv);
systemPath = systemPathEnv;
}
}
+
+ // Create new instance of the runtime
+ instance = new SCARuntime();
+
+ // load extensions
+ instance->loadExtensions();
+
}
return instance;
@@ -214,7 +263,7 @@
{
logentry();
- string extensionsRoot = SCARoot + "/extensions";
+ string extensionsRoot = installRoot + "/extensions";
#if defined(WIN32) || defined (_WINDOWS)
string pattern = "*.dll";
Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h?view=diff&rev=478646&r1=478645&r2=478646
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h Thu Nov 23 11:23:30 2006
@@ -78,22 +78,47 @@
SCA_API void load();
/**
+ * Set the directory in which the Tuscany runtime has been installed.
+ */
+ SCA_API static void setInstallRoot(const string& root);
+
+ /**
+ * Returns the directory in which the Tuscany runtime has been installed.
+ */
+ SCA_API static const string& getInstallRoot();
+
+ /**
* Set the system root
* @param root The path to the system configuration.
*/
- static void setSystemRoot(const string& root);
+ SCA_API static void setSystemRoot(const string& root);
+
+ /**
+ * Returns the system root
+ */
+ SCA_API static const string& getSystemRoot();
/**
* Set the search path for composites.
* @param path The search path for composites.
*/
- static void setSystemPath(const string& path);
+ SCA_API static void setSystemPath(const string& path);
+
+ /**
+ * Returns the search path for composites.
+ */
+ SCA_API static const string& getSystemPath();
/**
* Set the default Component for the system
* @param componentName The name of the default component.
*/
- static void setDefaultComponentName(const string& componentName);
+ SCA_API static void setDefaultComponentName(const string& componentName);
+
+ /**
+ * Returns the default Component for the system
+ */
+ SCA_API static const string& getDefaultComponentName();
/**
* Set the current component for the current thread.
@@ -118,11 +143,6 @@
SCA_API Composite* getSystem();
/**
- * The directory in which the Tuscany runtime has been installed.
- */
- SCA_API const string& getInstallRoot() {return SCARoot;}
-
- /**
* Return the current component for this thread.
* @return The current component for this thread.
*/
@@ -199,7 +219,7 @@
/**
* The installed path of the Tuscany runtime.
*/
- string SCARoot;
+ static string installRoot;
/**
* The path to the system configuration
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org