New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Config.pm in vendors/fcm/current/examples/lib/FCM/Admin – NEMO

source: vendors/fcm/current/examples/lib/FCM/Admin/Config.pm @ 1977

Last change on this file since 1977 was 1977, checked in by flavoni, 14 years ago

importing fcm vendor

File size: 5.9 KB
Line 
1# ------------------------------------------------------------------------------
2# (C) Crown copyright Met Office. All rights reserved.
3# For further details please refer to the file COPYRIGHT.txt
4# which you should have received as part of this distribution.
5# ------------------------------------------------------------------------------
6
7use strict;
8use warnings;
9
10package FCM::Admin::Config;
11
12use File::Spec;
13
14my $USER      = (getpwuid($<))[0];
15my $HOME      = (getpwuid($<))[7];
16my $LOCALDATA = File::Spec->catfile(q{/project/local}, $USER);
17
18# Default values for read-only attributes
19my %DEFAULT_R = (
20    admin_email          => q{fcm@metoffice.gov.uk},
21    fcm_home             => $HOME,
22    fcm_dist_on_desktops => q{/project/ukmo/utils/supported/portable},
23    fcm_dist_on_HPCs     => ['hpc1f:FCM/work/FCM/'],
24    fcm_wc               => File::Spec->catfile($HOME, qw{FCM work FCM}),
25    fcm_admin_wc         => File::Spec->catfile($HOME, qw{FCM work Admin}),
26    trac_gid             => scalar(getgrnam(q{apache})),
27    user_number_min      => 500,
28);
29
30# Default values for read-write attributes
31my %DEFAULT_RW = (
32    svn_backup_dir     => File::Spec->catfile($HOME, qw{svn backups}),
33    svn_dump_dir       => File::Spec->catfile($HOME, qw{svn dumps}),
34    svn_hook_dir       => File::Spec->catfile($HOME, qw{FCM work Admin svn-hooks}),
35    svn_live_dir       => File::Spec->catfile($LOCALDATA, qw{svn live}),
36    svn_passwd_file    => q{passwd},
37    svn_project_suffix => q{_svn},
38    trac_backup_dir    => File::Spec->catfile($HOME, qw{trac backups}),
39    trac_live_dir      => File::Spec->catfile($LOCALDATA, qw{trac live}),
40    trac_ini_file      => q{trac.ini},
41    trac_passwd_file   => q{trac.htpasswd},
42);
43
44my $INSTANCE;
45
46# ------------------------------------------------------------------------------
47# Returns a unique instance of this class.
48sub instance {
49    my ($class) = @_;
50    if (!$INSTANCE) {
51        $INSTANCE = bless({%DEFAULT_R, %DEFAULT_RW}, $class);
52    }
53    return $INSTANCE;
54}
55
56# ------------------------------------------------------------------------------
57# Getters
58for my $name (keys(%DEFAULT_R), keys(%DEFAULT_RW)) {
59    no strict qw{refs};
60    my $getter = qq{get_$name};
61    *$getter = sub {
62        my ($self) = @_;
63        return $self->{$name};
64    };
65}
66
67# ------------------------------------------------------------------------------
68# Setters
69for my $name (keys(%DEFAULT_RW)) {
70    no strict qw{refs};
71    my $setter = qq{set_$name};
72    *$setter = sub {
73        my ($self, $value) = @_;
74        $self->{$name} = $value;
75    };
76}
77
781;
79__END__
80
81=head1 NAME
82
83FCM::Admin::Config
84
85=head1 SYNOPSIS
86
87    $config = FCM::Admin::Config->instance();
88    $dir = $config->get_svn_backup_dir();
89    # ...
90
91=head1 DESCRIPTION
92
93This class is used to retrieve/store configurations required by FCM
94admininstration scripts.
95
96=head1 METHODS
97
98=over 4
99
100=item FCM::Admin::Config->instance()
101
102Returns a unique instance of this class. On first call, creates the instance
103with the configurations set to their default values.
104
105=item $config->get_admin_email()
106
107Returns the e-mail address of the FCM administrator.
108
109=item $config->get_fcm_home()
110
111Returns the HOME directory of the FCM administrator.
112
113=item $config->get_fcm_dist_on_desktops()
114
115Returns the path for distributing FCM on the desktops.
116
117=item $config->get_fcm_dist_on_HPCs()
118
119Returns a list of locations for distributing FCM on the HPCs.
120
121=item $config->get_fcm_wc()
122
123Returns the (working copy) source path of the default FCM distribution.
124
125=item $config->get_fcm_admin_wc()
126
127Returns the (working copy) source path of the default FCM admin distribution.
128
129=item $config->get_svn_backup_dir()
130
131Returns the path to a directory containing the backups of SVN repositories.
132
133=item $config->get_svn_dump_dir()
134
135Returns the path to a directory containing the revision dumps of SVN
136repositories.
137
138=item $config->get_svn_hook_dir()
139
140Returns the path to a directory containing source files of SVN hook scripts.
141
142=item $config->get_svn_live_dir()
143
144Returns the path to a directory containing the live SVN repositories.
145
146=item $config->get_svn_passwd_file()
147
148Returns the base name of the SVN password file.
149
150=item $config->get_svn_project_suffix()
151
152Returns the suffix added to the name of each SVN repository.
153
154=item $config->get_trac_backup_dir()
155
156Returns the path to a directory containing the backups of Trac environments.
157
158=item $config->get_trac_gid()
159
160Returns the group ID of the Trac server.
161
162=item $config->get_trac_live_dir()
163
164Returns the path to a directory containing the live Trac environments.
165
166=item $config->get_trac_ini_file()
167
168Returns the base name of the Trac INI file.
169
170=item $config->get_trac_passwd_file()
171
172Returns the base name of the Trac password file.
173
174=item $config->get_user_number_min()
175
176Returns the expected minimum number of users.
177
178=item $config->set_svn_backup_dir($value)
179
180Sets the path to a directory containing the backups of SVN repositories.
181
182=item $config->set_svn_dump_dir($value)
183
184Sets the path to a directory containing the revision dumps of SVN
185repositories.
186
187=item $config->set_svn_hook_dir($value)
188
189Sets the path to a directory containing source files of SVN hook scripts.
190
191=item $config->set_svn_live_dir($value)
192
193Sets the path to a directory containing the live SVN repositories.
194
195=item $config->set_svn_passwd_file($value)
196
197Sets the base name of the SVN password file.
198
199=item $config->set_svn_project_suffix($value)
200
201Sets the suffix added to the name of each SVN repository.
202
203=item $config->set_trac_backup_dir($value)
204
205Sets the path to a directory containing the backups of Trac environments.
206
207=item $config->set_trac_live_dir($value)
208
209Sets the path to a directory containing the live Trac environments.
210
211=item $config->set_trac_ini_file($value)
212
213Sets the base name of the Trac INI file.
214
215=item $config->set_trac_passwd_file($value)
216
217Sets the base name of the Trac password file.
218
219=back
220
221=head1 COPYRIGHT
222
223E<169> Crown copyright Met Office. All rights reserved.
224
225=cut
Note: See TracBrowser for help on using the repository browser.