BESXMLSetContainerCommand.cc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "BESXMLSetContainerCommand.h"
00034 #include "BESContainerStorageList.h"
00035 #include "BESXMLUtils.h"
00036 #include "BESUtil.h"
00037 #include "BESResponseNames.h"
00038 #include "BESDataNames.h"
00039 #include "BESSyntaxUserError.h"
00040 #include "BESDebug.h"
00041
00042 BESXMLSetContainerCommand::BESXMLSetContainerCommand( const BESDataHandlerInterface &base_dhi )
00043 : BESXMLCommand( base_dhi )
00044 {
00045 }
00046
00053 void
00054 BESXMLSetContainerCommand::parse_request( xmlNode *node )
00055 {
00056 string action ;
00057 string name ;
00058 string storage ;
00059 string value ;
00060
00061 map<string, string> props ;
00062 BESXMLUtils::GetNodeInfo( node, action, value, props ) ;
00063 if( action != SETCONTAINER_STR )
00064 {
00065 string err = "The specified command " + action
00066 + " is not a set container command" ;
00067 throw BESSyntaxUserError( err, __FILE__, __LINE__ ) ;
00068 }
00069
00070 if( value.empty() )
00071 {
00072 string err = action + " command: container real name missing" ;
00073 throw BESSyntaxUserError( err, __FILE__, __LINE__ ) ;
00074 }
00075
00076
00077 name = props["name"] ;
00078 if( name.empty() )
00079 {
00080 string err = action + " command: name property missing" ;
00081 throw BESSyntaxUserError( err, __FILE__, __LINE__ ) ;
00082 }
00083 _dhi.data[SYMBOLIC_NAME] = name ;
00084
00085
00086 _dhi.data[STORE_NAME] = PERSISTENCE_VOLATILE ;
00087 storage = props["space"] ;
00088 if( !storage.empty() )
00089 {
00090 _dhi.data[STORE_NAME] = storage ;
00091 }
00092 else
00093 {
00094 storage = PERSISTENCE_VOLATILE ;
00095 }
00096
00097
00098 string container_type = props["type"] ;
00099 _dhi.data[CONTAINER_TYPE] = container_type ;
00100
00101
00102 _dhi.data[REAL_NAME] = value ;
00103 _dhi.action = SETCONTAINER ;
00104
00105 _str_cmd = (string)"set container in " + storage
00106 + " values " + name + "," + value ;
00107 if( !container_type.empty() )
00108 {
00109 _str_cmd += "," + container_type ;
00110 }
00111 _str_cmd += ";" ;
00112
00113
00114
00115 BESXMLCommand::set_response() ;
00116 }
00117
00124 void
00125 BESXMLSetContainerCommand::dump( ostream &strm ) const
00126 {
00127 strm << BESIndent::LMarg << "BESXMLSetContainerCommand::dump - ("
00128 << (void *)this << ")" << endl ;
00129 BESIndent::Indent() ;
00130 BESXMLCommand::dump( strm ) ;
00131 BESIndent::UnIndent() ;
00132 }
00133
00134 BESXMLCommand *
00135 BESXMLSetContainerCommand::CommandBuilder( const BESDataHandlerInterface &base_dhi )
00136 {
00137 return new BESXMLSetContainerCommand( base_dhi ) ;
00138 }
00139