summaryrefslogtreecommitdiff
path: root/ACEXML/compass
diff options
context:
space:
mode:
Diffstat (limited to 'ACEXML/compass')
-rw-r--r--ACEXML/compass/Deployment.cpp64
-rw-r--r--ACEXML/compass/EC_Property.cpp33
-rw-r--r--ACEXML/compass/PropertyFile_Handler.cpp18
-rw-r--r--ACEXML/compass/SoftPkg.cpp10
-rw-r--r--ACEXML/compass/eventchannel.cpf3
-rw-r--r--ACEXML/compass/properties.xml23
-rw-r--r--ACEXML/compass/softpkg.xml11
7 files changed, 103 insertions, 59 deletions
diff --git a/ACEXML/compass/Deployment.cpp b/ACEXML/compass/Deployment.cpp
index ebe206f1b73..defc2a1332a 100644
--- a/ACEXML/compass/Deployment.cpp
+++ b/ACEXML/compass/Deployment.cpp
@@ -12,13 +12,23 @@
#include "ace/DLL.h"
#include "ace/SString.h"
-static ACE_ARGV myargv;
+struct ThrCreate
+{
+ const ACE_TCHAR* name;
+ int argc;
+ ACE_TCHAR** argv;
+};
+
void*
create_dll (void* name)
{
typedef int (*dll_func) (int, char**);
- const ACE_TCHAR* dllname = ACE_reinterpret_cast (const ACE_TCHAR*, name);
+ ThrCreate* thr = ACE_reinterpret_cast (ThrCreate*, name);
+ const ACE_TCHAR* dllname = thr->name;
+ const int argc = thr->argc;
+ ACE_TCHAR** argv = thr->argv;
+
if (dllname == 0)
{
ACE_ERROR ((LM_ERROR, "Trying to create a dll with null name"));
@@ -46,7 +56,7 @@ create_dll (void* name)
dll.error ()));
return (void*)-1;
}
- return (void*)factory (myargv.argc(), myargv.argv());
+ return (void*)factory (argc, argv);
}
static void
@@ -58,6 +68,14 @@ usage (const ACE_TCHAR* program)
program));
}
+static int
+error_cleanup (const ACE_TCHAR* dir)
+{
+ if (rmdir (dir) < 0)
+ ACE_ERROR ((LM_ERROR, "Unable to cleanup safe temp directory : %m\n"));
+ return -1;
+}
+
int
ACE_TMAIN (int argc, char* argv[])
{
@@ -73,8 +91,7 @@ ACE_TMAIN (int argc, char* argv[])
filename = get_opt.opt_arg ();
break;
default:
- usage(argv[0]);
- return -1;
+ break;
}
}
if (filename == 0)
@@ -82,6 +99,8 @@ ACE_TMAIN (int argc, char* argv[])
usage(argv[0]);
return -1;
}
+ ACE_ARGV myargv;
+
const ACEXML_Char meta_inf[] = {'m', 'e', 't', 'a', '-', 'i', 'n', 'f', 0};
ACEXML_Char* path = 0;
size_t pos = ACE_OS::strlen (filename);
@@ -157,7 +176,7 @@ ACE_TMAIN (int argc, char* argv[])
{
ACE_ERROR ((LM_ERROR, "Unable to set up environment for the Component"
"location: %m\n"));
- return -1;
+ return error_cleanup (temp);
}
ACEXML_String temp_dir (pwd);
temp_dir += "/";
@@ -174,11 +193,13 @@ ACE_TMAIN (int argc, char* argv[])
{
ACE_ERROR ((LM_ERROR, "Unable to set up environment for the Component"
"location: %m\n"));
- return -1;
+ return error_cleanup (temp);
}
ACE_Thread_Manager* thr_mgr = ACE_Thread_Manager::instance();
+ ThrCreate param;
+
const ACEXML_SoftPkg::Implementations& impls = pkg->get_impls();
ACEXML_SoftPkg::Implementation** entry = 0;
ACEXML_SoftPkg::Implementations::const_iterator iter (impls);
@@ -191,7 +212,7 @@ ACE_TMAIN (int argc, char* argv[])
{
ACE_ERROR ((LM_ERROR, "Unable to create stream for the Component"
"location %s\n", dll_path.c_str()));
- return -1;
+ return error_cleanup (temp);
}
ACEXML_String dsoname (temp);
dsoname += "/" + impl->code_.file_;
@@ -201,13 +222,13 @@ ACE_TMAIN (int argc, char* argv[])
{
ACE_ERROR ((LM_ERROR, "Unable to create local copy %s : %m\n",
dsoname.c_str()));
- return -1;
+ return error_cleanup (temp);
}
else if (ACE_OS::unlink (dsoname.c_str()) < 0)
{
ACE_ERROR ((LM_ERROR, "Unable to unlink local copy %s : %m\n",
dsoname.c_str()));
- return -1;
+ return error_cleanup (temp);
}
ACEXML_Char buf[65535];
int bytes = 0;
@@ -217,7 +238,7 @@ ACE_TMAIN (int argc, char* argv[])
{
ACE_ERROR ((LM_ERROR, "Unable to create dll %s: %m\n",
dsoname.c_str()));
- return -1;
+ return error_cleanup (temp);
}
}
ACE_OS::close (dso);
@@ -232,7 +253,7 @@ ACE_TMAIN (int argc, char* argv[])
{
ACE_ERROR ((LM_ERROR, "Failed to create input stream from %s\n",
path.c_str()));
- return -1;
+ return error_cleanup (temp);
}
ACEXML_PropertyFile_Handler* pHandler = 0;
ACE_NEW_RETURN (pHandler,
@@ -254,7 +275,8 @@ ACE_TMAIN (int argc, char* argv[])
ACEXML_CATCH (ACEXML_SAXException, ex)
{
ex.print();
- ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Parser Exception....\n")));
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("Parser Exception....\n")));
+ return error_cleanup (temp);
}
ACEXML_ENDTRY;
const ACEXML_Property* prop = pHandler->get_property();
@@ -264,10 +286,18 @@ ACE_TMAIN (int argc, char* argv[])
ACE_NEW_RETURN (pArgv, ACE_ARGV (list), -1);
}
if (pArgv)
- myargv.add (pArgv->argv());
+ {
+ myargv.add (pArgv->argv());
+ param.argv = myargv.argv();
+ param.argc = myargv.argc();
+ }
else
- myargv.add (argv);
- if (thr_mgr->spawn (create_dll,(void*)impl->id_.c_str()) == -1)
+ {
+ param.argc = argc;
+ param.argv = argv;
+ }
+ param.name = impl->id_.c_str();
+ if (thr_mgr->spawn (create_dll,(void*)&param) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Unable to spawn dll %s\n"),
@@ -278,7 +308,7 @@ ACE_TMAIN (int argc, char* argv[])
thr_mgr->wait();
if (rmdir (temp) < 0)
{
- ACE_ERROR ((LM_ERROR, "Unable to cleanup safe temp directory : %m\n"));
+ ACE_ERROR ((LM_ERROR, "Unable to cleanup temporary directory : %m\n"));
return -1;
}
return 0;
diff --git a/ACEXML/compass/EC_Property.cpp b/ACEXML/compass/EC_Property.cpp
index a0f293014dd..c6e8de22631 100644
--- a/ACEXML/compass/EC_Property.cpp
+++ b/ACEXML/compass/EC_Property.cpp
@@ -23,13 +23,6 @@ ACEXML_EC_Property::set (const ACEXML_String& property,
ACE_OS::strcasecmp (val, "mt") == 0)
{
this->ec_dispatching_ = value;
- if (this->ec_dispatching_threads_ <= 0)
- {
- ACE_ERROR ((LM_ERROR, "Invalid configuration ECDispatching = mt "
- "and ECDispatchingThreads = %ld\n",
- this->ec_dispatching_threads_));
- return -1;
- }
return 0;
}
}
@@ -44,7 +37,7 @@ ACEXML_EC_Property::set (const ACEXML_String& property,
}
}
else if (ACE_OS::strcasecmp (prop, "ECSupplierFiltering") == 0 ||
- ACE_OS::strcasecmp (prop, "ECSupplierFilter"))
+ ACE_OS::strcasecmp (prop, "ECSupplierFilter") == 0)
{
if (ACE_OS::strcasecmp (val, "null") == 0 ||
ACE_OS::strcasecmp (val, "per-supplier") == 0)
@@ -138,12 +131,8 @@ ACEXML_EC_Property::set (const ACEXML_String& property,
return 0;
}
}
- else
- {
- ACE_ERROR ((LM_ERROR, "Invalid property %s = %s\n", prop, val));
- return -1;
- }
- return 0;
+ ACE_ERROR ((LM_ERROR, "Invalid property %s = %s\n", prop, val));
+ return -1;
}
int
@@ -178,20 +167,22 @@ ACEXML_EC_Property::set (const ACEXML_String& property, const long value)
if (ACE_OS::strcasecmp (prop, "ECConsumerControlPeriod") == 0)
{
this->ec_consumer_control_period_ = value;
- if (this->ec_consumer_control_period_ <= 0)
+ if (this->ec_consumer_control_period_ != 0 &&
+ this->ec_consumer_control_period_ < 1000)
{
ACE_ERROR ((LM_ERROR, "Invalid configuration ECConsumerControlPeriod"
- " = %ld\n"));
+ " = %d\n", this->ec_consumer_control_period_));
return -1;
}
}
else if (ACE_OS::strcasecmp (prop, "ECSupplierControlPeriod") == 0)
{
this->ec_supplier_control_period_ = value;
- if (this->ec_supplier_control_period_ <= 0)
+ if (this->ec_supplier_control_period_ != 0 &&
+ this->ec_supplier_control_period_ < 1000)
{
ACE_ERROR ((LM_ERROR, "Invalid configuration ECSupplierControlPeriod"
- " = %ld\n"));
+ " = %d\n", this->ec_supplier_control_period_));
return -1;
}
}
@@ -200,8 +191,8 @@ ACEXML_EC_Property::set (const ACEXML_String& property, const long value)
this->ec_dispatching_threads_ = value;
if (this->ec_dispatching_threads_ <= 0)
{
- ACE_ERROR ((LM_ERROR, "Invalid configuration ECDispatching = mt "
- "and ECDispatchingThreads = %ld\n",
+ ACE_ERROR ((LM_ERROR, "Invalid value ECDispatchingThreads = %d "
+ "when ECDispatching = mt\n",
this->ec_dispatching_threads_));
return -1;
}
@@ -302,7 +293,7 @@ ACEXML_EC_Property::dump() const
if (this->ec_dispatching_threads_ > 0)
{
argv += " -ECDispatchingThreads ";
- pos += ACE_OS::sprintf (temp, "%ld", this->ec_consumer_control_period_);
+ pos += ACE_OS::sprintf (temp, "%ld", this->ec_dispatching_threads_);
temp[pos] = 0;
argv += temp;
}
diff --git a/ACEXML/compass/PropertyFile_Handler.cpp b/ACEXML/compass/PropertyFile_Handler.cpp
index f95b6d4955f..12b98fa594a 100644
--- a/ACEXML/compass/PropertyFile_Handler.cpp
+++ b/ACEXML/compass/PropertyFile_Handler.cpp
@@ -11,6 +11,8 @@
static const ACEXML_Char empty_string[] = {0};
+extern int errno;
+
ACEXML_PropertyFile_Handler::ACEXML_PropertyFile_Handler (const ACEXML_Char* filename)
: fileName_(ACE::strnew (filename)), locator_ (0), property_ (0)
{
@@ -90,12 +92,20 @@ ACEXML_PropertyFile_Handler::endElement (const ACEXML_Char *,
}
else if (this->atttype_ == "long")
{
- int save_errno = errno;
+ errno = 0;
long value = ACE_OS::strtol (this->value_.c_str(), 0, 10);
- if (errno != save_errno ||
- this->property_->set (this->attname_, value) != 0)
+ if (errno != 0)
+ {
+ ACE_ERROR ((LM_ERROR, "Property %s = %d invalid: %m\n",
+ this->attname_.c_str(), value));
+ ACEXML_SAXParseException* exception = 0;
+ ACE_NEW_NORETURN (exception,
+ ACEXML_SAXParseException ("Invalid Property"));
+ ACEXML_ENV_RAISE (exception);
+ }
+ else if (this->property_->set (this->attname_, value) != 0)
{
- ACE_ERROR ((LM_ERROR, "Property %s = %ld invalid: %m\n",
+ ACE_ERROR ((LM_ERROR, "Property %s = %d invalid\n",
this->attname_.c_str(), value));
ACEXML_SAXParseException* exception = 0;
ACE_NEW_NORETURN (exception,
diff --git a/ACEXML/compass/SoftPkg.cpp b/ACEXML/compass/SoftPkg.cpp
index e0bbea4fc2c..7e6fa61d07c 100644
--- a/ACEXML/compass/SoftPkg.cpp
+++ b/ACEXML/compass/SoftPkg.cpp
@@ -40,26 +40,26 @@ ACEXML_SoftPkg::dump (void)const
void
ACEXML_SoftPkg::PropertyFile::dump(void)const
{
- ACE_DEBUG ((LM_DEBUG, " Property File = %s\n", this->file_.c_str()));
+ ACE_DEBUG ((LM_DEBUG, "Property File = %s\n", this->file_.c_str()));
}
void
ACEXML_SoftPkg::OperSys::dump(void)const
{
- ACE_DEBUG ((LM_DEBUG, " Operating System: \n Name = %s\n Version = %s\n",
+ ACE_DEBUG ((LM_DEBUG, "OS = %s Version = %s\n",
this->name_.c_str(), this->version_.c_str()));
}
void
ACEXML_SoftPkg::Code::dump(void)const
{
- ACE_DEBUG ((LM_DEBUG, " Code: \n Type = %s\n File = %s\n "
+ ACE_DEBUG ((LM_DEBUG, " Code: \n Type = %s\n File = %s\n "
"EntryPoint = %s\n", this->type_.c_str(), this->file_.c_str(),
this->func_.c_str()));
}
void
ACEXML_SoftPkg::Dependency::dump(void)const
{
- ACE_DEBUG ((LM_DEBUG, "Dependency: \n Type = %s\n File = %s\n ",
+ ACE_DEBUG ((LM_DEBUG, "Dependency: \n Type = %s\n File = %s\n",
this->type_.c_str(), this->localfile_.c_str()));
}
void
@@ -67,7 +67,7 @@ ACEXML_SoftPkg::Implementation::dump(void)const
{
ACE_DEBUG ((LM_DEBUG, "Implementation: \n Id = %s\n ", this->id_.c_str()));
this->os_.dump();
- ACE_DEBUG ((LM_DEBUG, "Processor = %s\n Compiler = %s\n ProgLang = %s\n",
+ ACE_DEBUG ((LM_DEBUG, " Processor = %s\n Compiler = %s\n ProgLang = %s\n ",
this->cpu_.c_str(), this->compiler_.c_str(),
this->lang_.c_str()));
this->propfile_.dump();
diff --git a/ACEXML/compass/eventchannel.cpf b/ACEXML/compass/eventchannel.cpf
index 086a77b8c99..e015005de6e 100644
--- a/ACEXML/compass/eventchannel.cpf
+++ b/ACEXML/compass/eventchannel.cpf
@@ -6,6 +6,9 @@
<simple name="ECDispatching" type="string">
<value>mt</value>
</simple>
+ <simple name="ECDispatchingThreads" type="long">
+ <value>4</value>
+ </simple>
<simple name="ECFiltering" type="string">
<value>basic</value>
</simple>
diff --git a/ACEXML/compass/properties.xml b/ACEXML/compass/properties.xml
index 06a0da9bc15..c619cc0e0c3 100644
--- a/ACEXML/compass/properties.xml
+++ b/ACEXML/compass/properties.xml
@@ -2,32 +2,39 @@
<!DOCTYPE properties SYSTEM "properties.dtd">
<properties>
<struct name="ECProperties" type="EC_Properties">
- <description>Configuration for a Simple Event Channel</description>
+ <description>Simple Event Channel</description>
<simple name="ECDispactching" type="string">
<value>reactive</value>
</simple>
<simple name="ECFiltering" type="string">
<value>basic</value>
</simple>
- <simple name="ECSupplierFiltering" type="string">
+ <simple name="ECSupplierFiltering"
+ type="string">
<value>per-supplier</value>
</simple>
- <simple name="ECProxyConsumerLock" type="string">
+ <simple name="ECProxyConsumerLock"
+ type="string">
<value>thread</value>
</simple>
- <simple name="ECProxySupplierLock" type="string">
+ <simple name="ECProxySupplierLock"
+ type="string">
<value>thread</value>
</simple>
- <simple name="ECConsumerControl" type="string">
+ <simple name="ECConsumerControl"
+ type="string">
<value>reactive</value>
</simple>
- <simple name="ECSupplierControl" type="string">
+ <simple name="ECSupplierControl"
+ type="string">
<value>reactive</value>
</simple>
- <simple name="ECConsumerControlPeriod" type="long">
+ <simple name="ECConsumerControlPeriod"
+ type="long">
<value>50000</value>
</simple>
- <simple name="ECSupplierControlPeriod" type="long">
+ <simple name="ECSupplierControlPeriod"
+ type="long">
<value>50000</value>
</simple>
</struct>
diff --git a/ACEXML/compass/softpkg.xml b/ACEXML/compass/softpkg.xml
index e61cb4f4a6d..98b6d8169e9 100644
--- a/ACEXML/compass/softpkg.xml
+++ b/ACEXML/compass/softpkg.xml
@@ -3,10 +3,11 @@
<softpkg name="EventChannelPkg" version="0.1">
<pkgtype>CORBA Component</pkgtype>
<title>EventChannel</title>
- <author> <company>DOC group </company>
- <webpage href="http://www.cs.wustl.edu/~doc"/>
+ <author>
+ <company>DOC group </company>
+ <webpage href="http://www.cs.wustl.edu/~doc"/>
</author>
- <description>A simple Event Channel test </description>
+ <description>Simple Event Channel</description>
<dependency type="DSO" >
<localfile name="libTAO.so"/>
</dependency>
@@ -15,7 +16,9 @@
<processor name="x86" />
<compiler name="gcc" />
<programminglanguage name="C++" />
- <propertyfile> <fileinarchive name="eventchannel.cpf"/></propertyfile>
+ <propertyfile>
+ <fileinarchive name="eventchannel.cpf"/>
+ </propertyfile>
<code type="DSO" >
<fileinarchive name="libService.so"/>
<entrypoint>createEventChannel</entrypoint>