Commit 62b02d49 authored by Xavier Guimard's avatar Xavier Guimard

LEMONLDAP::NG : Doxygen documentation in progress

parent cef50ff7
......@@ -665,7 +665,7 @@ STRIP_CODE_COMMENTS = YES
# then for each documented function all documented
# functions referencing it will be listed.
REFERENCED_BY_RELATION = NO
REFERENCED_BY_RELATION = YES
# If the REFERENCES_RELATION tag is set to YES
# then for each documented function all documented entities
......
......@@ -141,12 +141,24 @@ sub more {
}
my @order = (
'Public Initialization Methods',
'Public Initialization Functions',
'Public Running Methods',
'Public Running Functions',
'Public Class Methods',
'Public Object Methods',
'Public Functions',
'Protected Initialization Methods',
'Protected Initialization Functions',
'Protected Running Methods',
'Protected Running Functions',
'Protected Class Methods',
'Protected Object Methods',
'Protected Functions',
'Private Initialization Methods',
'Private Initialization Functions',
'Private Running Methods',
'Private Running Functions',
'Private Class Methods',
'Private Object Methods',
'Private Functions',
......
......@@ -113,6 +113,24 @@ print LOG $_;
@more,
"\@nosubgrouping"
] );
} elsif ($command eq 'imethod') {
unless ($args) {
($args) = $self->analyze_sub( $line-1 );
}
$args = $self->munge_parameters($args);
$self->push($self->protection($args).' Initialization Methods');
$self->start("\@fn $args")->more(@more)->end;
$self->print($args, ";\n");
$self->pop;
} elsif ($command eq 'rmethod') {
unless ($args) {
($args) = $self->analyze_sub( $line-1 );
}
$args = $self->munge_parameters($args);
$self->push($self->protection($args).' Running Methods');
$self->start("\@fn $args")->more(@more)->end;
$self->print($args, ";\n");
$self->pop;
} elsif ($command eq 'cmethod') {
unless ($args) {
($args) = $self->analyze_sub( $line-1 );
......@@ -122,6 +140,24 @@ print LOG $_;
$self->start("\@fn $args")->more(@more)->end;
$self->print($args, ";\n");
$self->pop;
} elsif ($command eq 'ifn') {
unless ($args) {
($args) = $self->analyze_sub( $line-1 );
}
$args = $self->munge_parameters($args);
$self->push($self->protection($args).' Initialization Functions');
$self->start("\@fn $args")->more(@more)->end;
$self->print($args, ";\n");
$self->pop;
} elsif ($command eq 'rfn') {
unless ($args) {
($args) = $self->analyze_sub( $line-1 );
}
$args = $self->munge_parameters($args);
$self->push($self->protection($args).' Running Functions');
$self->start("\@fn $args")->more(@more)->end;
$self->print($args, ";\n");
$self->pop;
} elsif ($command eq 'fn') {
unless ($args) {
($args) = $self->analyze_sub( $line-1 );
......@@ -169,6 +205,9 @@ print LOG $_;
if( $current_class && @args && ($args[0] eq "\$self") ) {
$self->push($self->protection($proto).' Object Methods');
$proto =~ s/\$self,*\s*//;
} elsif( $current_class && @args && ($args[0] eq "\$self") ) {
$self->push($self->protection($proto).' Initialization Methods');
$proto =~ s/\$self,*\s*//;
} elsif( $current_class
&& ((@args && ($args[0] eq "\$class")) || ($name eq "new")) ) {
$self->push($self->protection($proto).' Class Methods');
......
#!/usr/bin/perl -I.
#!/usr/bin/perl -Iscripts
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
......
##@file
# Base package for Lemonldap::NG configuration system
##@class
# Implements Lemonldap::NG shared configuration system.
# In case of error or warning, the message is stored in the global variable
# $Lemonldap::NG::Common::Conf::msg
package Lemonldap::NG::Common::Conf;
use strict;
......@@ -13,6 +20,21 @@ our $msg;
our %_confFiles;
## @cmethod Lemonldap::NG::Common::Conf new(hashRef arg)
# Constructor.
# Succeed if it has found a way to access to Lemonldap::NG configuration with
# $arg (or default file). It can be :
# - Nothing: default configuration file is tested,
# - { File => "/path/to/storage.conf" },
# - { Type => "File", dirName => "/path/to/conf/dir/" },
# - { Type => "DBI", dbiChain => "DBI:mysql:database=lemonldap-ng;host=1.2.3.4",
# dbiUser => "user", dbiPassword => "password" },
# - { Type => "SOAP", proxy => "https://manager.example.com/soapmanager.pl" },
#
# $self->{type} contains the type of configuration access system and the
# corresponding package is loaded.
# @param $arg hash reference or hash table
# @return New Lemonldap::NG::Common::Conf object
sub new {
my $class = shift;
my $self = bless {}, $class;
......@@ -52,6 +74,10 @@ sub new {
return $self;
}
## @method private boolean _readConfFile(string file)
# Read $file to know how to access to Lemonldap::NG configuration.
# @param $file Optional file name (default: /etc/lemonldap-ng/storage.conf)
# @return True if the file was successfuly read
sub _readConfFile {
my $self = shift;
my $file = shift || DEFAULTCONFFILE;
......@@ -81,6 +107,10 @@ sub _readConfFile {
return 1;
}
## @method int saveConf(hashRef conf)
# Serialize $conf and call store().
# @param $conf Lemonldap::NG configuration hashRef
# @return Number of the saved configuration, 0 if case of error.
sub saveConf {
my ( $self, $conf ) = @_;
......@@ -115,6 +145,14 @@ sub saveConf {
return $self->store($fields);
}
## @method hashRef getConf(hashRef args)
# Get configuration from remote configuration storage system or from local
# cache if configuration has not been changed. If $args->{local} is set and if
# a local configuration is available, remote configuration is not tested.
#
# Uses lastCfg to test and getDBConf() to get the remote configuration
# @param $args Optional, contains {local=>1} or nothing
# @return Lemonldap::NG configuration
sub getConf {
my ( $self, $args ) = @_;
if ( $args->{'local'}
......@@ -139,11 +177,20 @@ sub getConf {
}
}
## @method void setLocalConf(hashRef conf)
# Store $conf in the local cache.
# @param $conf Lemonldap::NG configuration hashRef
sub setLocalConf {
my ( $self, $conf ) = @_;
$self->{refLocalStorage}->set( "conf", $conf );
}
## @method hashRef getDBConf(hashRef args)
# Get configuration from remote storage system.
# @param $args hashRef that must contains a key "cfgNum" (number of the wanted
# configuration) and optionaly a key "fields" that points to an array of wanted
# configuration keys
# @return Lemonldap::NG configuration hashRef
sub getDBConf {
my ( $self, $args ) = @_;
return undef unless $args->{cfgNum};
......@@ -198,38 +245,67 @@ sub getDBConf {
return $conf;
}
## @method boolean prereq()
# Call prereq() from the $self->{type} package.
# @return True if succeed
sub prereq {
return &{ $_[0]->{type} . '::prereq' }(@_);
}
## @method @ available()
# Call available() from the $self->{type} package.
# @return list of available configuration numbers
sub available {
return &{ $_[0]->{type} . '::available' }(@_);
}
## @method int lastCfg()
# Call lastCfg() from the $self->{type} package.
# @return Number of the last configuration available
sub lastCfg {
return &{ $_[0]->{type} . '::lastCfg' }(@_);
}
## @method boolean lock()
# Call lock() from the $self->{type} package.
# @return True if succeed
sub lock {
return &{ $_[0]->{type} . '::lock' }(@_);
}
## @method boolean isLocked()
# Call isLocked() from the $self->{type} package.
# @return True if database is locked
sub isLocked {
return &{ $_[0]->{type} . '::isLocked' }(@_);
}
## @method boolean unlock()
# Call unlock() from the $self->{type} package.
# @return True if succeed
sub unlock {
return &{ $_[0]->{type} . '::unlock' }(@_);
}
## @method int store(hashRef conf)
# Call store() from the $self->{type} package.
# @param $conf Lemondlap configuration serialized
# @return Number of new configuration stored if succeed, 0 else.
sub store {
return &{ $_[0]->{type} . '::store' }(@_);
}
## @method load(int cfgNum, arrayRef fields)
# Call load() from the $self->{type} package.
# @return Lemonldap::NG Configuration hashRef if succeed, 0 else.
sub load {
return &{ $_[0]->{type} . '::load' }(@_);
}
## @method boolean delete(int cfgNum)
# Call delete() from the $self->{type} package.
# @param $cfgNum Number of configuration to delete
# @return True if succeed
sub delete {
my ( $self, $c ) = @_;
my @a = $self->available();
......
......@@ -5,6 +5,16 @@
## @class
# Main handler.
# All methods in handler are class methods: in ModPerl environment, handlers
# are always launched without object created.
#
# The main method is run() who is called by Apache for each requests (using
# handler() wrapper).
#
# The initialization process is splitted in two parts :
# - init() is launched as Apache startup
# - globalInit() is launched at each first request received by an Apache child
# and each time a new configuration is detected
package Lemonldap::NG::Handler::SharedConf;
use strict;
......@@ -46,7 +56,7 @@ BEGIN {
# INIT PROCESS
## @cmethod void init(hashRef args)
## @imethod void init(hashRef args)
# Constructor.
# init is overloaded to call only localInit. globalInit is called later.
# @param $args hash containing parameters
......@@ -57,7 +67,7 @@ sub init($$) {
$class->localInit($args);
}
## @cmethod void defaultValuesInit(hashRef args)
## @imethod protected void defaultValuesInit(hashRef args)
# Set default values for non-customized variables
# @param $args hash containing parameters
# @return boolean
......@@ -69,7 +79,7 @@ sub defaultValuesInit {
return $class->SUPER::defaultValuesInit( \%h );
}
## @cmethod void localInit(hashRef args)
## @imethod void localInit(hashRef args)
# Load parameters and build the Lemonldap::NG::Common::Conf object.
# @return boolean
sub localInit {
......@@ -88,7 +98,7 @@ sub localInit {
# MAIN
## @cmethod int run(Apache2::RequestRec r)
## @rmethod int run(Apache2::RequestRec r)
# Check configuration and launch Lemonldap::NG::Handler::Simple::run().
# Each $reloadTime, the Apache child verify if its configuration is the same
# as the configuration stored in the local storage.
......@@ -107,7 +117,7 @@ sub run($$) {
# CONFIGURATION UPDATE
## @cmethod int testConf(boolean local)
## @rmethod protected int testConf(boolean local)
# Test if configuration has changed and launch setConf() if needed.
# If the optional boolean $local is true, remote configuration is not tested:
# only local cached configuration is tested if available. $local is given to
......@@ -131,7 +141,7 @@ sub testConf {
OK;
}
## @cmethod int setConf(hashRef conf)
## @rmethod protected int setConf(hashRef conf)
# Launch globalInit().
# Local parameters have best precedence on configuration parameters.
# @return Apache constant
......@@ -149,10 +159,12 @@ sub setConf {
*reload = *refresh;
## @cmethod int refresh(Apache::RequestRec r)
## @rmethod int refresh(Apache::RequestRec r)
# Launch testConf() with $local=0, so remote configuration is tested.
# Then build a simple HTTP response that just returns "200 OK" or
# "500 Server Error".
# @param $r current request
# @return Apache constant
# @return Apache constant (OK or SERVER_ERROR)
sub refresh($$) {
my ( $class, $r ) = @_;
$class->lmLog( "$class: request for configuration reload", 'notice' );
......
......@@ -3,8 +3,6 @@
#
# @copy 2008 Xavier Guimard <x.guimard@free.fr>
## @class
# Status process mechanism
package Lemonldap::NG::Handler::Status;
use strict;
......@@ -18,7 +16,7 @@ our $activity = [];
our $start = int( time / 60 );
use constant MN_COUNT => 5;
## @fn hashRef portalTab()
## @fn private hashRef portalTab()
# @return Constant hash used to convert error codes into string.
sub portalTab {
return {
......@@ -55,7 +53,7 @@ eval {
POSIX::setuid( ( getpwnam( $ENV{APACHE_RUN_USER} ) )[2] );
};
## @fn void run(string localStorage, hashRef localStorageOptions)
## @rfn void run(string localStorage, hashRef localStorageOptions)
# Main.
# Reads requests from STDIN to :
# - update counts
......@@ -213,7 +211,7 @@ sub run {
}
}
## @fn string timeUp(int d)
## @rfn private string timeUp(int d)
# Return the time since the status process was launched (last Apache reload).
# @param $d Number of minutes since start
# @return Date in format "day hour minute"
......@@ -226,7 +224,7 @@ sub timeUp {
return "$d\d $h\h $mn\mn";
}
## @fn void topByCat(string cat,int max)
## @rfn private void topByCat(string cat,int max)
# Display the "top 10" fao a category (OK, REDIRECT,...).
# @param $cat Category to display
# @param $max Number of lines to display
......@@ -247,7 +245,7 @@ sub topByCat {
print "</pre>\n";
}
## @fn void head()
## @rfn private void head()
# Display head of HTML status responses.
sub head {
print <<"EOF";
......
......@@ -15,7 +15,7 @@ our $VERSION = '0.54';
## @cmethod void locationRulesInit(hashRef args)
# Compile rules.
# Rules are stored in $args->{locationRules}->{<virtualHost>} that contains
# Rules are stored in $args->{locationRules}->{&lt;virtualhost&gt;} that contains
# regexp=>test expressions where :
# - regexp is used to test URIs
# - test contains an expression used to grant the user
......@@ -51,7 +51,7 @@ sub locationRulesInit {
}
## @cmethod void forgeHeadersInit(hashRef args)
# Create the &$forgeHeaders->{<virtualHost>} subroutines used to insert
# Create the &$forgeHeaders->{&lt;virtualhost&gt;} subroutines used to insert
# headers into the HTTP request.
# @param $args reference to the configuration hash
sub forgeHeadersInit {
......
......@@ -138,7 +138,7 @@ sub error {
*error_type = *Lemonldap::NG::Portal::Simple::error_type;
## @method boolean displayModule(modulename)
## @method boolean displayModule(string modulename)
# Return true if the user can see the module.
# Use for HTML::Template variable.
# @param $modulename string
......
......@@ -73,7 +73,7 @@ sub search {
PE_OK;
}
## @methor int setSessionInfo()
## @method int setSessionInfo()
# 7) Load all parameters included in exportedVars parameter.
# Multi-value parameters are loaded in a single string with
# '; ' separator
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment