summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2004-10-07 02:56:30 +0000
committerbala <balanatarajan@users.noreply.github.com>2004-10-07 02:56:30 +0000
commitc8bb5144f998ef2c2d2bbb7fc21bc458acc5a666 (patch)
tree7c8853ede6c9bf12f70b4203593a7cfb1aba0588
parent8f965baeb9758a104d9f7c1609dd3a396b5f4c63 (diff)
downloadATCD-c8bb5144f998ef2c2d2bbb7fc21bc458acc5a666.tar.gz
ChangeLogTag:Thu Oct 7 02:52:31 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu>
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/ChangeLog34
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/Config_Handlers.mpc3
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.cpp65
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.h16
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.cpp112
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.h64
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/Singleton_IDREF_Map.cpp12
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/Singleton_IDREF_Map.h3
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/XML_Error_Handler.cpp60
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/XML_Error_Handler.h65
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/XML_File_Intf.cpp58
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/XML_File_Intf.h51
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.cpp194
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.h65
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/XercesString.cpp145
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/XercesString.h86
16 files changed, 1008 insertions, 25 deletions
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/ChangeLog b/TAO/CIAO/DAnCE/Config_Handlers/ChangeLog
index af55316e064..3a1d3aa4c52 100644
--- a/TAO/CIAO/DAnCE/Config_Handlers/ChangeLog
+++ b/TAO/CIAO/DAnCE/Config_Handlers/ChangeLog
@@ -1,3 +1,37 @@
+Thu Oct 7 02:52:31 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu>
+
+
+ * DAnCE/Config_Handlers/DP_Handler.cpp:
+ * DAnCE/Config_Handlers/DP_Handler.h:
+ * DAnCE/Config_Handlers/DP_PCD_Handler.cpp:
+ * DAnCE/Config_Handlers/DP_PCD_Handler.h:
+ * DAnCE/Config_Handlers/Singleton_IDREF_Map.cpp:
+ * DAnCE/Config_Handlers/Singleton_IDREF_Map.h:
+ * DAnCE/Config_Handlers/XML_Error_Handler.cpp:
+ * DAnCE/Config_Handlers/XML_Error_Handler.h:
+ * DAnCE/Config_Handlers/XML_File_Intf.cpp:
+ * DAnCE/Config_Handlers/XML_File_Intf.h:
+ * DAnCE/Config_Handlers/XML_Helper.cpp:
+ * DAnCE/Config_Handlers/XML_Helper.h:
+ * DAnCE/Config_Handlers/XercesString.cpp:
+ * DAnCE/Config_Handlers/XercesString.h:
+
+ A set of classses that does the following
+
+ (1) Take the file name for the deployment plan
+ (2) Initialize xerces and make a DOM
+ (3) Convert the DOM into DeploymentPlan generated by XSC.
+ (4) Convert the Object of type DeploymentPlan to
+ Deployment::DeploymentPlan
+
+ We had most of the C++->IDL convesrion. This checkin
+ concebtrates in 1 through 3.
+
+ * DAnCE/Config_Handlers/Config_Handlers.mpc:
+
+ Added the new files into the project.
+
+
Sun Oct 3 03:38:28 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu>
* DAnCE/Config_Handlers/ADD_Handler.cpp:
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/Config_Handlers.mpc b/TAO/CIAO/DAnCE/Config_Handlers/Config_Handlers.mpc
index 8430b561173..da4996de49c 100644
--- a/TAO/CIAO/DAnCE/Config_Handlers/Config_Handlers.mpc
+++ b/TAO/CIAO/DAnCE/Config_Handlers/Config_Handlers.mpc
@@ -44,6 +44,9 @@ project (XSC_Config_Handlers) : ciao_deployment_stub {
ComponentPropertyDescription_Handler.cpp
RDD_Handler.cpp
ID_Handler.cpp
+ XML_Error_Handler.cpp
+ XML_Helper.cpp
+ XML_File_Intf.cpp
}
Header_Files {
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.cpp
index e68a6389299..f14400e6ecc 100644
--- a/TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.cpp
+++ b/TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.cpp
@@ -1,11 +1,12 @@
#include "DP_Handler.h"
#include "ciao/Deployment_DataC.h"
-#include "ace/Auto_Ptr.h"
+
#include "CCD_Handler.h"
#include "ADD_Handler.h"
#include "MDD_Handler.h"
#include "IDD_Handler.h"
#include "cdp.hpp"
+#include "Singleton_IDREF_Map.h"
ACE_RCSID (Config_Handlers,
DP_Handler,
@@ -18,14 +19,36 @@ namespace CIAO
DP_Handler::DP_Handler (DeploymentPlan &dp)
: idl_dp_ (0)
, dp_ (dp)
+ , retval_ (false)
{
if (!this->resolve_plan ())
throw;
}
DP_Handler::~DP_Handler (void)
+ throw ()
+ {
+ (void) Singleton_IDREF_Map::instance ()->unbind_refs ();
+ }
+
+ ::Deployment::DeploymentPlan const *
+ DP_Handler::plan (void) const
+ throw (NoPlan)
+ {
+ if (this->retval_)
+ return this->idl_dp_.get ();
+
+ throw NoPlan ();
+ }
+
+ ::Deployment::DeploymentPlan *
+ DP_Handler::plan (void)
+ throw (NoPlan)
{
- delete this->idl_dp_;
+ if (this->retval_)
+ return this->idl_dp_.release ();
+
+ throw NoPlan ();
}
bool
@@ -34,43 +57,39 @@ namespace CIAO
::Deployment::DeploymentPlan *tmp =
new Deployment::DeploymentPlan;
- auto_ptr< ::Deployment::DeploymentPlan>
- auto_idl_dp (tmp);
+ this->idl_dp_.reset (tmp);
- bool retval =
+ this->retval_ =
CCD_Handler::component_interface_descr (
this->dp_.realizes (),
- (*auto_idl_dp).realizes);
+ this->idl_dp_->realizes);
- if (!retval)
- return retval;
+ if (!this->retval_)
+ return this->retval_;
- retval =
+ this->retval_ =
ADD_Handler::artifact_deployment_descrs (
this->dp_,
- (*auto_idl_dp).artifact);
+ this->idl_dp_->artifact);
- if (!retval)
- return retval;
+ if (!this->retval_)
+ return this->retval_;
- retval =
+ this->retval_ =
MDD_Handler::mono_deployment_descriptions (
this->dp_.implementation (),
- (*auto_idl_dp).implementation);
+ this->idl_dp_->implementation);
- if (!retval)
- return retval;
+ if (!this->retval_)
+ return this->retval_;
- retval =
+ this->retval_ =
IDD_Handler::instance_deployment_descrs (
this->dp_,
- (*auto_idl_dp).instance);
-
- if (!retval)
- return retval;
+ this->idl_dp_->instance);
- this->idl_dp_ =
- auto_idl_dp.release ();
+ if (!this->retval_)
+ return this->retval_;
return true;
}
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.h
index 397c69407fa..9967070ad67 100644
--- a/TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.h
+++ b/TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.h
@@ -13,6 +13,7 @@
#include /**/ "ace/pre.h"
#include "Config_Handlers/Config_Handlers_Export.h"
+#include "ace/Auto_Ptr.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
@@ -38,9 +39,18 @@ namespace CIAO
class Config_Handlers_Export DP_Handler
{
public:
+ class NoPlan {};
+
DP_Handler (DeploymentPlan &dp);
- ~DP_Handler (void);
+ ~DP_Handler (void)
+ throw ();
+
+ ::Deployment::DeploymentPlan const *plan (void) const
+ throw (NoPlan);
+
+ ::Deployment::DeploymentPlan *plan (void)
+ throw (NoPlan);
private:
@@ -48,9 +58,11 @@ namespace CIAO
private:
- ::Deployment::DeploymentPlan *idl_dp_;
+ auto_ptr< ::Deployment::DeploymentPlan> idl_dp_;
DeploymentPlan &dp_;
+
+ bool retval_;
};
}
}
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.cpp
new file mode 100644
index 00000000000..61cc196778d
--- /dev/null
+++ b/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.cpp
@@ -0,0 +1,112 @@
+// $Id$
+
+#include "DP_PCD_Handler.h"
+#include "CEPE_Handler.h"
+#include "PSPE_Handler.h"
+#include "ERE_Handler.h"
+#include "CRDD_Handler.h"
+#include "Basic_Deployment_Data.hpp"
+#include "cdp.hpp"
+#include "ciao/Deployment_DataC.h"
+
+namespace CIAO
+{
+ namespace Config_Handlers
+ {
+ bool
+ DP_PCD_Handler::plan_connection_descrs (
+ const DeploymentPlan &src,
+ Deployment::PlanConnectionDescriptions& dest)
+ {
+ DeploymentPlan::connection_const_iterator cci_e =
+ src.end_connection ();
+
+ for (DeploymentPlan::connection_const_iterator cci_b =
+ src.begin_connection ();
+ cci_b != cci_e;
+ ++cci_b)
+ {
+ CORBA::ULong len =
+ dest.length ();
+
+ dest.length (len + 1);
+
+ bool retval =
+ DP_PCD_Handler::plan_connection_descr (
+ *(cci_b),
+ dest[len]);
+
+ if (!retval)
+ return retval;
+ }
+
+ return true;
+ }
+
+ bool
+ DP_PCD_Handler::plan_connection_descr (
+ const PlanConnectionDescription &src,
+ Deployment::PlanConnectionDescription &dest)
+ {
+ dest.name =
+ src.name ().c_str ();
+
+ if (src.source_p ())
+ {
+ // There will be only one as per the schema
+ dest.source.length (1);
+ dest.source[0] =
+ src.source ().c_str ();
+ }
+
+
+ if (!CEPE_Handler::external_port_endpoints (src,
+ dest.externalEndpoint))
+ return false;
+
+ if (!ERE_Handler::external_ref_endpoints (src,
+ dest.externalReference))
+ return false;
+
+ if (!PSPE_Handler::sub_component_port_endpoints (src,
+ dest.internalEndpoint))
+ return false;
+
+#if 0
+ // @@MAJO: Need to figure how to use this.
+ if (desc.deployedResource_p ())
+ {
+ CRDD_Handler crddhandler;
+
+ toconfig.deployedResource.length (
+ toconfig.deployedResource.length () + 1);
+
+ crddhandler.get_ConnectionResourceDeploymentDescription (
+ toconfig.deployedResource[toconfig.deployedResource.length () - 1],
+ desc.deployedResource ());
+ }
+
+ if (desc.deployRequirement_p ())
+ {
+
+ // @@ MAJO: Not sure how to use this
+ //Create the handler for the requirements.
+ Requirement_Handler reqhandler;
+
+ //Increase the sequence length and delgate
+ //the Requirement to the Req_Handler.
+ toconfig.deployRequirement.length (
+ toconfig.deployRequirement.length () + 1);
+ reqhandler.get_Requirement (
+ toconfig.deployRequirement[toconfig.deployRequirement.length () - 1],
+ desc.deployRequirement ());
+
+
+ return 0;
+ }
+#endif /*if 0*/
+
+ return true;
+ }
+ }
+}
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.h
new file mode 100644
index 00000000000..16439cd0014
--- /dev/null
+++ b/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.h
@@ -0,0 +1,64 @@
+//==============================================================
+/**
+ * @file DP_PCD_Handler.h
+ *
+ * $Id$
+ *
+ * Handler for Deployment::PlanConnectionHandler
+ *
+ * @author Jules White <jules@dre.vanderbilt.edu>
+ */
+//================================================================
+
+#ifndef CIAO_CONFIG_HANDLERS_DP_PCD_HANDLER_H
+#define CIAO_CONFIG_HANDLERS_DP_PCD_HANDLER_H
+#include /**/ "ace/pre.h"
+
+#include "Config_Handlers/Config_Handlers_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+namespace Deployment
+{
+ struct PlanConnectionDescription;
+ class PlanConnectionDescriptions;
+}
+
+namespace CIAO
+{
+
+ namespace Config_Handlers
+ {
+ class DeploymentPlan;
+ class PlanConnectionDescription;
+
+ /*
+ * @class DP_PCD_Handler
+ *
+ * @brief Handler class for <PlanConnectionDescription> types.
+ *
+ * This class defines handler methods to map values from
+ * XSC PlanConnectionDescription objects, parsed from
+ * the descriptor files, to the corresponding CORBA IDL type.
+ *
+ */
+
+ class Config_Handlers_Export DP_PCD_Handler
+ {
+ public:
+ static bool plan_connection_descrs (
+ const DeploymentPlan &src,
+ Deployment::PlanConnectionDescriptions& toconfig);
+
+ private:
+ static bool plan_connection_descr (
+ const PlanConnectionDescription& desc,
+ Deployment::PlanConnectionDescription& toconfig);
+ };
+ }
+}
+
+#include /**/ "ace/post.h"
+#endif /* CIAO_CONFIG_HANDLERS_PCD_HANDLER_H*/
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/Singleton_IDREF_Map.cpp b/TAO/CIAO/DAnCE/Config_Handlers/Singleton_IDREF_Map.cpp
index e1c973b490a..3ffc4e36cce 100644
--- a/TAO/CIAO/DAnCE/Config_Handlers/Singleton_IDREF_Map.cpp
+++ b/TAO/CIAO/DAnCE/Config_Handlers/Singleton_IDREF_Map.cpp
@@ -37,5 +37,17 @@ namespace CIAO
return true;
}
+ bool
+ IDREF_Map::unbind_refs (void)
+ {
+ int retval =
+ this->idref_map_.unbind_all ();
+
+ if (retval < 0)
+ return false;
+
+ return true;
+ }
+
}
}
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/Singleton_IDREF_Map.h b/TAO/CIAO/DAnCE/Config_Handlers/Singleton_IDREF_Map.h
index 23e003938a9..8cfecda5bde 100644
--- a/TAO/CIAO/DAnCE/Config_Handlers/Singleton_IDREF_Map.h
+++ b/TAO/CIAO/DAnCE/Config_Handlers/Singleton_IDREF_Map.h
@@ -63,6 +63,9 @@ namespace CIAO
*/
bool find_ref (const ACE_CString& id, size_t val);
+ /// Unbind all the elements
+ bool unbind_refs (void);
+
private:
typedef ACE_Hash_Map_Manager<ACE_CString,
size_t,
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XML_Error_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/XML_Error_Handler.cpp
new file mode 100644
index 00000000000..d7f7fde0fe5
--- /dev/null
+++ b/TAO/CIAO/DAnCE/Config_Handlers/XML_Error_Handler.cpp
@@ -0,0 +1,60 @@
+// $Id$
+
+#include "XML_Error_Handler.h"
+#include "ace/Log_Msg.h"
+#include "ace/Auto_Ptr.h"
+#include <xercesc/util/XMLString.hpp>
+#include <xercesc/dom/DOMLocator.hpp>
+#include "XercesString.h"
+
+using xercesc::XMLString;
+
+namespace CIAO
+{
+ namespace Config_Handlers
+ {
+ XML_Error_Handler::XML_Error_Handler (void)
+ : errors_ (false)
+ {
+ }
+
+ XML_Error_Handler::~XML_Error_Handler()
+ {
+ }
+
+
+ bool
+ XML_Error_Handler::handleError (const DOMError& domError)
+ {
+ this->errors_ = true;
+
+ if (domError.getSeverity() == DOMError::DOM_SEVERITY_WARNING)
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t), Warning "));
+ else if (domError.getSeverity() == DOMError::DOM_SEVERITY_ERROR)
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t), Error "));
+ else
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t), Fatal Error "));
+ char *msg =
+ XMLString::transcode (domError.getMessage ());
+
+ ACE_Auto_Basic_Array_Ptr<char> cleanup_msg (msg);
+
+ return true;
+ }
+
+ void
+ XML_Error_Handler::resetErrors (void)
+ {
+ this->errors_ = false;
+ }
+
+ bool
+ XML_Error_Handler::getErrors (void) const
+ {
+ return this->errors_;
+ }
+ }
+}
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XML_Error_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/XML_Error_Handler.h
new file mode 100644
index 00000000000..e2a88e67a3b
--- /dev/null
+++ b/TAO/CIAO/DAnCE/Config_Handlers/XML_Error_Handler.h
@@ -0,0 +1,65 @@
+//==============================================================
+/**
+ * @file XML_Error_Hander.h
+ *
+ * $Id$
+ *
+ * @brief Error handler for Xerces
+ *
+ * @author Bala Natarajan <bala@dre.vanderbilt.edu>
+ */
+//================================================================
+#ifndef CIAO_CONFIG_HANLDERS_ERROR_HANDLER_H
+#define CIAO_CONFIG_HANLDERS_ERROR_HANDLER_H
+
+#include /**/ "ace/pre.h"
+
+#include "Config_Handlers/Config_Handlers_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include <xercesc/dom/DOMErrorHandler.hpp>
+
+using xercesc::DOMErrorHandler;
+using xercesc::DOMError;
+
+namespace CIAO
+{
+ namespace Config_Handlers
+ {
+ /**
+ * @class XML_Error_Hander
+ *
+ * @brief Error handler for XERCES
+ *
+ */
+ class Config_Handlers_Export XML_Error_Handler
+ : public DOMErrorHandler
+ {
+ public:
+
+ XML_Error_Handler (void);
+
+ ~XML_Error_Handler (void);
+
+ bool handleError (const DOMError& domError);
+
+ void resetErrors (void);
+
+ bool getErrors(void) const;
+
+ private :
+ // Disallow copying
+ XML_Error_Handler (const XML_Error_Handler&);
+ XML_Error_Handler& operator= (const XML_Error_Handler&);
+
+ bool errors_;
+ };
+ }
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_CONFIG_HANLDERS_ERROR_HANDLER_H*/
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XML_File_Intf.cpp b/TAO/CIAO/DAnCE/Config_Handlers/XML_File_Intf.cpp
new file mode 100644
index 00000000000..9b0c108bb00
--- /dev/null
+++ b/TAO/CIAO/DAnCE/Config_Handlers/XML_File_Intf.cpp
@@ -0,0 +1,58 @@
+// $Id$
+#include "XML_File_Intf.h"
+#include "XML_Helper.h"
+#include "Deployment.hpp"
+#include "DP_Handler.h"
+#include "ciao/Deployment_DataC.h"
+
+namespace CIAO
+{
+ namespace Config_Handlers
+ {
+ XML_File_Intf::XML_File_Intf (const char *file)
+ {
+ if (!this->read_process_file (file))
+ throw;
+ }
+
+ bool
+ XML_File_Intf::read_process_file (const char *file)
+ {
+ XML_Helper helper;
+
+ if (!helper.is_initialized ())
+ return false;
+
+ XERCES_CPP_NAMESPACE::DOMDocument *dom =
+ helper.create_dom (file);
+
+ if (!dom)
+ return false;
+
+ DeploymentPlan dp =
+ deploymentPlan (dom);
+
+
+ DP_Handler dp_handler (dp);
+
+ this->idl_dp_.reset (dp_handler.plan ());
+
+ if (this->idl_dp_.get ())
+ return true;
+
+ return false;
+ }
+
+ ::Deployment::DeploymentPlan const *
+ XML_File_Intf::get_plan (void) const
+ {
+ return this->idl_dp_.get ();
+ }
+
+ ::Deployment::DeploymentPlan *
+ XML_File_Intf::get_plan (void)
+ {
+ return this->idl_dp_.release ();
+ }
+ }
+}
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XML_File_Intf.h b/TAO/CIAO/DAnCE/Config_Handlers/XML_File_Intf.h
new file mode 100644
index 00000000000..73ade3566ed
--- /dev/null
+++ b/TAO/CIAO/DAnCE/Config_Handlers/XML_File_Intf.h
@@ -0,0 +1,51 @@
+//==============================================================
+/**
+ * @file DP_Handler.h
+ *
+ * $Id$
+ *
+ * @author Bala Natarajan <bala@dre.vanderbilt.edu>
+ */
+//================================================================
+
+#ifndef CIAO_CONFIG_XML_FILE_INTF_H
+#define CIAO_CONFIG_XML_FILE_INTF_H
+#include /**/ "ace/pre.h"
+
+#include "Config_Handlers/Config_Handlers_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Auto_Ptr.h"
+
+
+namespace Deployment
+{
+ struct DeploymentPlan ;
+}
+
+namespace CIAO
+{
+ namespace Config_Handlers
+ {
+ class Config_Handlers_Export XML_File_Intf
+ {
+ public:
+ XML_File_Intf (const char *file);
+
+ ::Deployment::DeploymentPlan const *get_plan (void) const;
+ ::Deployment::DeploymentPlan *get_plan (void);
+
+ protected:
+
+ bool read_process_file (const char *file);
+
+ private:
+ auto_ptr< ::Deployment::DeploymentPlan> idl_dp_;
+ };
+ }
+}
+#include /**/ "ace/post.h"
+#endif /*CIAO_CONFIG_XML_FILE_INTF_H*/
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.cpp b/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.cpp
new file mode 100644
index 00000000000..a95df7e7301
--- /dev/null
+++ b/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.cpp
@@ -0,0 +1,194 @@
+//$Id$
+#include "XML_Helper.h"
+#include "ace/Auto_Ptr.h"
+#include "ace/Log_Msg.h"
+#include "xercesc/util/XMLUniDefs.hpp"
+#include "xercesc/dom/DOM.hpp"
+#include "XML_Error_Handler.h"
+
+
+namespace CIAO
+{
+ namespace Config_Handlers
+ {
+ using xercesc::XMLException;
+ using xercesc::XMLString;
+ using xercesc::DOMImplementation;
+ using xercesc::DOMImplementationRegistry;
+ using xercesc::DOMBuilder;
+ using xercesc::DOMImplementationLS;
+ using xercesc::XMLUni;
+ using xercesc::DOMDocument;
+ using xercesc::DOMException;
+
+ XML_Helper::XML_Helper (void)
+ : initialized_ (false)
+ {
+ this->init_parser ();
+ }
+
+ XML_Helper::~XML_Helper (void)
+ {
+ this->terminate_parser ();
+ }
+
+ bool
+ XML_Helper::is_initialized (void) const
+ {
+ return this->initialized_ == true;
+ }
+
+ void
+ XML_Helper::init_parser (void)
+ {
+ if (this->initialized_)
+ return;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Initializing the Xerces runtime \n"));
+ // Initialize the Xerces run-time
+ try
+ {
+ xercesc::XMLPlatformUtils::Initialize();
+ }
+ catch (const XMLException& e)
+ {
+ char* message =
+ XMLString::transcode (e.getMessage());
+ ACE_Auto_Basic_Array_Ptr<char> cleanup_message (message);
+
+ throw;
+ }
+ catch (...)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Some other exception,"
+ " returning\n"));
+
+ return;
+ }
+
+ this->initialized_ = true;
+ return;
+ }
+
+ XERCES_CPP_NAMESPACE::DOMDocument *
+ XML_Helper::create_dom (const ACE_TCHAR *url)
+ {
+
+ if (url == 0)
+ throw;
+
+ try
+ {
+ // Instantiate the DOM parser.
+ static const XMLCh gLS[] = { xercesc::chLatin_L,
+ xercesc::chLatin_S,
+ xercesc::chNull };
+
+ // Get an implementation of the Load-Store (LS) interface
+ DOMImplementation* impl =
+ DOMImplementationRegistry::getDOMImplementation(gLS);
+
+ // Create a DOMBuilder
+ DOMBuilder* parser =
+ impl->createDOMBuilder (DOMImplementationLS::MODE_SYNCHRONOUS,
+ 0);
+
+ // Discard comment nodes in the document
+ parser->setFeature (XMLUni::fgDOMComments, false);
+
+ // Disable datatype normalization. The XML 1.0 attribute value
+ // normalization always occurs though.
+ parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true);
+
+ // Do not create EntityReference nodes in the DOM tree. No
+ // EntityReference nodes will be created, only the nodes
+ // corresponding to their fully expanded sustitution text will be
+ // created.
+ parser->setFeature (XMLUni::fgDOMEntities, false);
+
+ // Perform Namespace processing.
+ parser->setFeature (XMLUni::fgDOMNamespaces, true);
+
+ // Perform Validation
+ parser->setFeature (XMLUni::fgDOMValidation, true);
+
+ // Do not include ignorable whitespace in the DOM tree.
+ parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false);
+
+ // Enable the parser's schema support.
+ parser->setFeature (XMLUni::fgXercesSchema, true);
+
+ // Enable full schema constraint checking, including checking which
+ // may be time-consuming or memory intensive. Currently, particle
+ // unique attribution constraint checking and particle derivation
+ // restriction checking are controlled by this option.
+ parser->setFeature (XMLUni::fgXercesSchemaFullChecking, true);
+
+ // The parser will treat validation error as fatal and will exit.
+ parser->setFeature (XMLUni::fgXercesValidationErrorAsFatal, true);
+
+ XML_Error_Handler handler;
+
+ parser->setErrorHandler (&handler);
+
+ DOMDocument* doc = parser->parseURI (url);
+
+ if (handler.getErrors ())
+ throw;
+
+ return doc;
+ }
+ catch (const DOMException& e)
+ {
+ const unsigned int maxChars = 2047;
+ XMLCh errText[maxChars + 1];
+
+ if (DOMImplementation::loadDOMExceptionMsg (e.code,
+ errText,
+ maxChars))
+ {
+ char* message =
+ XMLString::transcode (errText);
+ ACE_Auto_Basic_Array_Ptr<char> cleanup_message (message);
+ }
+ return 0;
+
+ }
+ catch (const XMLException& e)
+ {
+ char* message = XMLString::transcode (e.getMessage());
+ ACE_Auto_Basic_Array_Ptr<char> cleanup_message (message);
+ throw;
+ }
+ catch (...)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Caught an unknown exception \n"));
+ throw;
+ }
+
+ return 0;
+ }
+
+ void
+ XML_Helper::terminate_parser (void)
+ {
+ try
+ {
+ xercesc::XMLPlatformUtils::Terminate();
+ }
+ catch (const XMLException& e)
+ {
+ char* message =
+ XMLString::transcode (e.getMessage());
+ ACE_Auto_Basic_Array_Ptr<char> cleanup_message (message);
+ throw;
+ }
+
+ this->initialized_ = false;
+ return;
+ }
+ }
+}
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.h b/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.h
new file mode 100644
index 00000000000..9920ece69fd
--- /dev/null
+++ b/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.h
@@ -0,0 +1,65 @@
+// $Id$
+//============================================================
+/**
+ * @file XML_Helper.h
+ *
+ * @brief Some helper functions for XML
+ *
+ * @author Bala Natarajan <bala@dre.vanderbilt.edu>
+ */
+//============================================================
+#ifndef CIAO_CONFIG_HANDLERS_XML_HELPER_H
+#define CIAO_CONFIG_HANDLERS_XML_HELPER_H
+#include /**/ "ace/pre.h"
+
+#include "Config_Handlers/Config_Handlers_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "xercesc/util/XercesDefs.hpp"
+
+namespace XERCES_CPP_NAMESPACE
+{
+ class DOMDocument;
+}
+
+
+namespace CIAO
+{
+ namespace Config_Handlers
+ {
+ /**
+ * @class XML_Helper
+ *
+ * @brief Helper class for some routine XML stuff.
+ */
+ class Config_Handlers_Export XML_Helper
+ {
+ public:
+ XML_Helper (void);
+
+ ~XML_Helper (void);
+
+ /// Create a DOM tree
+ XERCES_CPP_NAMESPACE::DOMDocument *
+ create_dom (const ACE_TCHAR *uri);
+
+ bool is_initialized (void) const;
+
+ protected:
+ /// Intialize the parser
+ void init_parser (void);
+
+ /// Terminate the parser
+ void terminate_parser (void);
+
+ private:
+ bool initialized_;
+ };
+ }
+}
+
+#include /**/ "ace/post.h"
+#endif/*CIAO_CONFIG_HANDLERS_XML_HELPER_H*/
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XercesString.cpp b/TAO/CIAO/DAnCE/Config_Handlers/XercesString.cpp
new file mode 100644
index 00000000000..db2f21b8c61
--- /dev/null
+++ b/TAO/CIAO/DAnCE/Config_Handlers/XercesString.cpp
@@ -0,0 +1,145 @@
+// $Id$
+
+#include <iostream>
+
+#include "XercesString.h"
+using xercesc::XMLString;
+
+namespace DRM
+{
+
+ XStr::XStr (const char* str)
+ : _wstr(0)
+ {
+ _wstr = XMLString::transcode(str);
+ }
+
+ XStr::XStr (XMLCh *wstr)
+ : _wstr(wstr)
+ {
+
+ }
+
+ XStr::XStr (const XMLCh* wstr)
+ : _wstr(0)
+ {
+ _wstr = XMLString::replicate(wstr);
+ }
+
+ XStr::XStr (const XStr &right)
+ : _wstr(0)
+ {
+ _wstr = XMLString::replicate(right._wstr);
+ }
+
+ XStr& XStr::operator= (const XStr& rhs)
+ {
+ if (&rhs == this)
+ return *this;
+ XStr temp (rhs);
+ ACE_Swap<XMLCh*>::swap (this->_wstr, temp._wstr);
+ return *this;
+ }
+
+ XStr::~XStr ()
+ {
+ if (_wstr)
+ XMLString::release(&_wstr);
+ }
+
+ const XMLCh* XStr::begin () const
+ {
+ return _wstr;
+ }
+
+ const XMLCh* XStr::end () const
+ {
+ return _wstr + size();
+ }
+
+ bool XStr::append(const XMLCh *tail)
+ {
+ int iTailLen = XMLString::stringLen(tail);
+ int iWorkLen = XMLString::stringLen(_wstr);
+ XMLCh *result = new XMLCh[ iWorkLen + iTailLen + 1 ];
+ bool bOK = result != 0;
+ if (bOK)
+ {
+ XMLCh *target = result;
+ XMLString::moveChars(target, _wstr, iWorkLen);
+ target += iWorkLen;
+ XMLString::moveChars(target, tail, iTailLen);
+ target += iTailLen;
+ *target++ = 0;
+ XMLString::release(&_wstr);
+ _wstr = result;
+ }
+ return bOK;
+ }
+
+ bool XStr::erase(const XMLCh *head, const XMLCh *tail)
+ {
+ bool bOK = head <= tail && head >= begin() && tail <= end();
+ if (bOK)
+ {
+ XMLCh *result = new XMLCh[ size() - (tail - head) + 1 ];
+ XMLCh *target = result;
+ bOK = target != NULL;
+ if (bOK)
+ {
+ const XMLCh *cursor = begin();
+
+ while (cursor != head) *target++ = *cursor++;
+ cursor = tail;
+ while ( cursor != end() ) *target++ = *cursor++;
+ *target ++ = 0;
+ XMLString::release(&_wstr);
+ _wstr = result;
+ }
+ }
+ return bOK;
+ }
+
+ int XStr::size () const
+ {
+ return XMLString::stringLen(_wstr);
+ }
+
+ XMLCh XStr::operator [] (const int i)
+ {
+ return _wstr[i];
+ }
+
+ const XMLCh XStr::operator [] (const int i) const
+ {
+ return _wstr[i];
+ }
+
+ bool XStr::operator== (const XMLCh* wstr) const
+ {
+ return XMLString::compareIString (wstr, this->_wstr) == 0;
+ }
+
+ bool operator== (const XStr& lhs, const XStr& rhs)
+ {
+ return XMLString::equals (lhs,rhs);
+ }
+
+ bool operator!= (const XStr& lhs, const XStr& rhs)
+ {
+ return !operator==(lhs, rhs);
+ }
+
+
+ std::ostream&
+ operator<< (std::ostream& o, XStr const& str)
+ {
+ char* s (XMLString::transcode (str));
+
+ o << s;
+
+ XMLString::release (&s); // idiots?
+ return o;
+ }
+
+}
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XercesString.h b/TAO/CIAO/DAnCE/Config_Handlers/XercesString.h
new file mode 100644
index 00000000000..553a70f45f7
--- /dev/null
+++ b/TAO/CIAO/DAnCE/Config_Handlers/XercesString.h
@@ -0,0 +1,86 @@
+// $Id$
+//==============================================================
+/**
+ * @file XercesString.h
+ *
+ * $Id$
+ *
+ * @brief Helper method for XerceString
+ *
+ * @author Bala Natarajan <bala@dre.vanderbilt.edu>
+ */
+//================================================================
+#ifndef CIAO_CONFIG_HANLDERS_XERCES_STRING_H
+#define CIAO_CONFIG_HANLDERS_XERCES_STRING_H
+#include /**/ "ace/pre.h"
+
+#include "ace/Swap.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include <iosfwd>
+
+#include <xercesc/util/XMLString.hpp>
+
+namespace CIAO
+{
+ namespace Config_Handlers
+ {
+ /**
+ * @class XStr
+ *
+ * @brief
+ *
+ */
+ class Config_Handlers_Export XStr
+ {
+ public:
+ XStr() : _wstr(0L) { };
+
+ XStr (const char* str);
+
+ XStr (XMLCh* wstr);
+
+ XStr (const XMLCh* wstr);
+
+ XStr (const XStr& copy);
+
+ XStr& operator= (const XStr& rhs);
+
+ ~XStr();
+
+ const XMLCh* begin () const;
+
+ const XMLCh* end () const;
+
+ bool append (const XMLCh* tail);
+
+ bool erase (const XMLCh* head, const XMLCh* tail);
+
+ int size () const;
+
+ XMLCh operator [] (const int i);
+
+ const XMLCh operator [] (const int i) const;
+
+ operator const XMLCh* () const { return _wstr; };
+
+ bool operator== (const XMLCh* wstr) const;
+
+ private:
+
+ XMLCh* _wstr; // Internal representation
+ };
+
+ bool operator== (const XStr& lhs, const XStr& rhs);
+ bool operator!= (const XStr& lhs, const XStr& rhs);
+
+ std::ostream& operator<< (std::ostream& o, XStr const& str);
+ }
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* _XERCESSTRING_H */