68 NCMLContainer::NCMLContainer(
const string &sym_name,
const string &xml_doc) :
69 BESContainer(sym_name,
"",
"ncml"), _xml_doc(xml_doc), _accessed(false)
74 BESContainer(copy_from), _xml_doc(copy_from._xml_doc), _accessed(copy_from._accessed)
79 string err = (string)
"The Container has already been accessed, " +
"can not create a copy of this container.";
86 if (copy_to._accessed) {
87 string err = (string)
"The Container has already been accessed, " +
"can not duplicate this resource.";
90 copy_to._xml_doc = _xml_doc;
91 copy_to._accessed =
false;
117 BESDEBUG(
"ncml",
"accessing " << _xml_doc << endl);
123 string tempfile_template =
"ncml_module_XXXXXX";
124 #if defined(WIN32) || defined(TEST_WIN32_TEMPS)
125 char *tempfile_c = _mktemp( (
char *)tempfile_template.c_str() );
127 char *tempfile_c = mktemp((
char *) tempfile_template.c_str());
131 tempfile = tempfile_c;
134 string err = (string)
"Unable to create temporary ncml document " + _tmp_file_name;
143 ostrm.open(_tmp_file_name.c_str(), ios_base::out);
147 string err = (string)
"Unable to write out the ncml document " + _tmp_file_name;
149 char *str = strerror(my_errno);
150 if (str) err += (string)
" " + str;
156 ostrm <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
159 ostrm << _xml_doc << endl;
165 return _tmp_file_name;
176 if (_accessed && !_tmp_file_name.empty()) {
177 unlink(_tmp_file_name.c_str());
193 strm <<
BESIndent::LMarg <<
"NCMLContainer::dump - (" << (
void *)
this <<
")" << endl;
exception thrown if inernal error encountered
Container representing a NCML request.
virtual void dump(ostream &strm) const
dumps information about this object
static string NCML_TempDir
static ostream & LMarg(ostream &strm)
virtual BESContainer * ptr_duplicate()
pure abstract method to duplicate this instances of BESContainer
void _duplicate(BESContainer ©_to)
duplicate this instance into the passed container
void _duplicate(NCMLContainer ©_to)
virtual bool release()
release the NCML cached resources
virtual string access()
access the NCML target response by making the NCML request
virtual void dump(ostream &strm) const
dumps information about this object
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
A container is something that holds data.