Revision 4c8b82e2 include/VirtualMachineTemplate.h
include/VirtualMachineTemplate.h | ||
---|---|---|
29 | 29 |
class VirtualMachineTemplate : public Template |
30 | 30 |
{ |
31 | 31 |
public: |
32 |
VirtualMachineTemplate(): |
|
33 |
Template(false,'=',"TEMPLATE"){}; |
|
32 |
VirtualMachineTemplate():Template(false,'=',"TEMPLATE"){}; |
|
34 | 33 |
|
35 | 34 |
VirtualMachineTemplate( |
36 | 35 |
bool _replace_mode, |
... | ... | |
42 | 41 |
|
43 | 42 |
VirtualMachineTemplate(VirtualMachineTemplate& vmt):Template(vmt){}; |
44 | 43 |
|
45 |
/** |
|
46 |
* Checks the template for RESTRICTED ATTRIBUTES |
|
47 |
* @param rs_attr the first restricted attribute found if any |
|
48 |
* @return true if a restricted attribute is found in the template |
|
49 |
*/ |
|
50 |
bool check(string& rs_attr) |
|
51 |
{ |
|
52 |
return Template::check(rs_attr, restricted_attributes); |
|
53 |
}; |
|
54 |
|
|
55 |
/** |
|
56 |
* Deletes all restricted attributes |
|
57 |
*/ |
|
58 |
void remove_restricted() |
|
59 |
{ |
|
60 |
Template::remove_restricted(restricted_attributes); |
|
61 |
}; |
|
62 |
|
|
63 |
/** |
|
64 |
* Deletes all the attributes, except the restricted ones |
|
65 |
*/ |
|
66 |
void remove_all_except_restricted() |
|
67 |
{ |
|
68 |
Template::remove_all_except_restricted(restricted_attributes); |
|
69 |
}; |
|
70 |
|
|
71 | 44 |
void set_xml_root(const char * _xml_root) |
72 | 45 |
{ |
73 | 46 |
Template::set_xml_root(_xml_root); |
... | ... | |
85 | 58 |
target_name, const string& target_uname, const string& new_name, |
86 | 59 |
const string& new_uname); |
87 | 60 |
|
88 |
private: |
|
61 |
// ------------------------------------------------------------------------- |
|
62 |
// Restricted attributes interface implementation |
|
63 |
// ------------------------------------------------------------------------- |
|
64 |
virtual void remove_restricted() |
|
65 |
{ |
|
66 |
Template::remove_restricted(restricted); |
|
67 |
}; |
|
89 | 68 |
|
90 |
friend class VirtualMachinePool; |
|
69 |
virtual bool check_restricted(string& rs_attr, const Template& base) |
|
70 |
{ |
|
71 |
return Template::check_restricted(rs_attr, base, restricted); |
|
72 |
} |
|
91 | 73 |
|
92 |
static vector<string> restricted_attributes; |
|
74 |
virtual bool check_restricted(string& rs_attr) |
|
75 |
{ |
|
76 |
return Template::check_restricted(rs_attr, restricted); |
|
77 |
} |
|
93 | 78 |
|
94 |
bool has_restricted()
|
|
79 |
static void parse_restricted(vector<const SingleAttribute *>& ra)
|
|
95 | 80 |
{ |
96 |
return restricted_attributes.size() > 0;
|
|
97 |
};
|
|
81 |
Template::parse_restricted(ra, restricted);
|
|
82 |
} |
|
98 | 83 |
|
84 |
private: |
|
99 | 85 |
/** |
100 |
* Stores the attributes as restricted, these attributes will be used in |
|
101 |
* VirtualMachineTemplate::check |
|
102 |
* @param rattrs Attributes to restrict |
|
86 |
* Restricted attribute list for VirtualMachineTemplates |
|
103 | 87 |
*/ |
104 |
static void set_restricted_attributes(vector<const SingleAttribute *>& rattrs) |
|
105 |
{ |
|
106 |
Template::set_restricted_attributes(rattrs, restricted_attributes); |
|
107 |
}; |
|
88 |
static std::map<std::string, std::set<std::string> > restricted; |
|
108 | 89 |
}; |
109 | 90 |
|
110 | 91 |
/* -------------------------------------------------------------------------- */ |
Also available in: Unified diff