summaryrefslogtreecommitdiff
path: root/modules/CIAO/tools/Config_Handlers/XML_File_Intf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/CIAO/tools/Config_Handlers/XML_File_Intf.cpp')
-rw-r--r--modules/CIAO/tools/Config_Handlers/XML_File_Intf.cpp103
1 files changed, 103 insertions, 0 deletions
diff --git a/modules/CIAO/tools/Config_Handlers/XML_File_Intf.cpp b/modules/CIAO/tools/Config_Handlers/XML_File_Intf.cpp
new file mode 100644
index 00000000000..eed90d47245
--- /dev/null
+++ b/modules/CIAO/tools/Config_Handlers/XML_File_Intf.cpp
@@ -0,0 +1,103 @@
+// $Id$
+
+#include "XML_File_Intf.h"
+#include "XML_Typedefs.h"
+#include "Deployment.hpp"
+#include "DP_Handler.h"
+#include "Common.h"
+
+#include "DAnCE/Deployment/Deployment_DataC.h"
+#include "ciao/CIAO_common.h"
+
+namespace CIAO
+{
+ namespace Config_Handlers
+ {
+ XML_File_Intf::XML_File_Intf (const ACE_TCHAR *file)
+ : file_ (file),
+ idl_dp_ (0)
+ {
+ }
+
+ bool
+ XML_File_Intf::read_process_file (const ACE_TCHAR *file)
+ {
+ CIAO_TRACE("XML_File_Intf::read_process_file");
+
+ try
+ {
+ if (!XML_Helper::XML_HELPER.is_initialized ())
+ return false;
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "XML_File_Intf::read_process_file - "
+ "Constructing DOM\n"));
+ XERCES_CPP_NAMESPACE::DOMDocument *dom =
+ XML_Helper::XML_HELPER.create_dom ((file));
+
+ if (dom == 0)
+ {
+ CIAO_DEBUG ((LM_TRACE, CLINFO "XML_File_Intf::read_process_file - "
+ "Failed to open file %s\n", file));
+ return false;
+ }
+
+ XERCES_CPP_NAMESPACE::DOMElement *foo = dom->getDocumentElement ();
+ CIAO_DEBUG ((LM_TRACE, CLINFO "XML_File_Intf::read_process_file - "
+ "DOMElement pointer: %u\n", foo));
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "XML_File_Intf::read_process_file - "
+ "Parsing XML file with XSC\n"));
+ deploymentPlan dp =
+ CIAO::Config_Handlers::reader::DeploymentPlan (dom);
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO "XML_File_Intf::read_process_file - "
+ "Processing using config handlers\n"));
+ DP_Handler dp_handler (dp);
+
+ this->idl_dp_.reset (dp_handler.plan ());
+
+ if (this->idl_dp_.get ())
+ return true;
+ }
+ catch (const Config_Error &ex)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "XML_File_Intf::error at %C: %C\n",
+ ex.name_.c_str (), ex.error_.c_str ()));
+ }
+ catch (...)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "XML_File_Intf::caught - "
+ "Unexpected exception whilst parsing XML into IDL.\n"));
+ }
+
+ return false;
+ }
+
+ ::Deployment::DeploymentPlan const *
+ XML_File_Intf::get_plan (void)
+ {
+ CIAO_TRACE("get_plan");
+ if (this->idl_dp_.get () == 0 && !this->read_process_file (this->file_.c_str ()))
+ return 0;
+
+ return this->idl_dp_.get ();
+ }
+
+ ::Deployment::DeploymentPlan *
+ XML_File_Intf::release_plan (void)
+ {
+ CIAO_TRACE("XML_File_Intf::get_plan");
+ if (this->idl_dp_.get () == 0 && !this->read_process_file (this->file_.c_str ()))
+ return 0;
+ return this->idl_dp_.release ();
+ }
+
+ void
+ XML_File_Intf::add_search_path (const ACE_TCHAR *environment,
+ const ACE_TCHAR *relpath)
+ {
+ XML_Helper::_path_resolver.add_path (environment, relpath);
+ }
+
+ }
+}