1
package EBox::OpenVPN::ModulePartition;
2
# this module may become EBox::GConfModule if other modules found it useful
3
# package: create a kind of pseudo-partition in the configuration tree of a module
11
# Creates a new module partition
14
# $base - the portion of configuration namespace used for the partition
15
# $fullModule - a instance of the GConfModule to which belongs the partition
19
# a blessed instance of the partition
22
my ($class, $base, $fullModule) = @_;
24
if (!$fullModule->dir_exists($base) ) {
25
throw EBox::Exceptions::Internal("Tried to instantiate a module partition with a space not found in module configuration: $base");
28
my $self = { fullModule => $fullModule, confKeysBase => $base };
37
my ($self, $key) = @_;
38
return $self->{confKeysBase} . "/$key";
44
# gets the module which contains the partition
48
# the module which contais the partition
52
return $self->{fullModule};
57
# Method: confKeysBase
59
# gets the configuration directory where the partition's configuration resides
63
# the partition's configuration directory as string
66
my ($self, $key) = @_;
67
return $self->{confKeysBase};
72
my ($self, $key) = @_;
73
$key = $self->confKey($key);
74
$self->fullModule->get_string($key);
79
my ($self, $key, $value) = @_;
80
$key = $self->confKey($key);
81
$self->fullModule->set_string($key, $value);
87
my ($self, $key) = @_;
88
$key = $self->confKey($key);
89
$self->fullModule->get_int($key);
94
my ($self, $key, $value) = @_;
95
$key = $self->confKey($key);
96
$self->fullModule->set_int($key, $value);
102
my ($self, $key) = @_;
103
$key = $self->confKey($key);
104
return $self->fullModule->dir_exists($key);
110
{ my ($self, $key) = @_;
111
$key = $self->confKey($key);
112
return $self->fullModule->delete_dir($key);
115
sub allConfEntriesBase
117
my ($self, $key) = @_;
118
$key = $self->confKey($key);
119
return $self->fullModule->all_entries_base($key);
125
my ($self, $key) = @_;
126
$key = $self->confKey($key);
127
return $self->fullModule->unset($key);
133
my ($self, $key) = @_;
134
$key = $self->confKey($key);
135
$self->fullModule->get_bool($key);
140
my ($self, $key, $value) = @_;
141
$key = $self->confKey($key);
142
$self->fullModule->set_bool($key, $value);