NAME
    Lemonldap::Config::Parameters - Backend of configuration for lemonldap
    SSO system
    SOAPserver.pm  - handler for mod_perl SOAP server

SYNOPSIS
      #!/usr/bin/perl 
      use Lemonldap::Config::Parameters;
      use Data::Dumper;
      my $nconfig= Lemonldap::Config::Parameters->new(
                                 file  =>'applications.xml',
                                 cache => 'CONF' );
      my $conf= $nconfig->getAllConfig;
      my $cg=$nconfig->getDomain('appli.cp');
      my $ligne= $cg;
      print Dumper( $ligne);
      my $e = $cg->{templates_options} ;
      my $opt= "templates_dir";
      my $va = $cg->{$opt};
      my $ligne= $nconfig->formateLineHash($e,$opt,$va) ;

     or by API :

     Lemonldap::Config::Parameters::f_delete('CONF');

     or by command line 

     perl -e "use Lemonldap::Config::Parameters;
    Lemonldap::Config::Parameters::f_delete('CONF');"
  
DESCRIPTION
    Lemonldap is a SSO system under GPL.

    Login page , handlers must retrieve their configs in an unique file eg
    :"applications.xml".

    This file has a XML structrure. The parsing phase may be heavy, so
    lemonldap can cache the result of parsing in memory with IPC. For
    activing the cache you must have in the config :

     <cache id="CONF" ConfigTtl="1000"
                        LastModifed="1"> 
     </cache> 
 
    with : name='CONF' it's the GLUE value : four letters (see
    IPC::Shareable documentation). Ttl: time to live in second ( 0 for not
    reload ) if ttl is too short the config file will be reload very offen .

            LastModified="1"  If true , you can force the reload  after anything modification on file  

     You can force the reload off file by the command line bellow:

     perl -e "use Lemonldap::Config::Parameters;
     Lemonldap::Config::Parameters::f_reload('CONF');"

     or 

     perl -e "use Lemonldap::Config::Parameters;
     Lemonldap::Config::Parameters::f_delete('CONF');"

    IMPORTANT : the user's ID who runs those scripts MUST be the same of the
    IPC cache's owner !!

     WITHOUT CACHE SPECIFICATION , LEMONLDAP DOESN'T USE CACHE ! It  will read and
    parse config file each time.
 
METHODS
  new  (file  =>'/foo/my_xml_file.xml' ,
                 cache => 'CONF' );  # with IPC cache
     or 
            new(file  =>'/foo/my_xml_file.xml');     # without IPC  cache

  getAllConfig
     Return the  reference of hash  storing whole the config.

  getDomain('foo.bar')
     Return the reference of hash of config for domain  
     If the config file has only one domain , domain may bo omit .  

    eg : for the xml config file : <domain name="foo.bar" cookie=".foo.bar"
    path ="/" templates_dir="/opt/apache/portail/templates"
    templates_options = "ABSOLUTE => '1', INCLUDE_PATH => 'templates_dir'"
    login ="http://cportail.foo.bar/portail/accueil.pl" menu=
    "http://cportail.foo.bar/portail/application.pl" ldap_server
    ="cpldap.foo.bar" ldap_port="389" DnManager= "cn=Directory Manager"
    passwordManager="secret" branch_people="ou=mefi,dc=foo,dc=bar"
    session="memcached" > </domain>

        my $cg = $nconfig->getDomain();

      DB<2> x $cg
       0  HASH(0x89b108c)
        'DnManager' => 'cn=Directory Manager'
        'branch_people' => 'ou=mefi,dc=foo,dc=bar'
        'cookie' => '.foo.bar'
        'ldap_port' => 389
        'ldap_server' => 'cpldap.foo.bar'
        'login' => 'http://cportail.foo.bar/portail/accueil.pl'
        'menu' => 'http://cportail.foo.bar/portail/application.pl'
        'passwordManager' => 'secret'
        'path' => '/'
        'session' => 'memcached'
        'templates_dir' => '/opt/apache/portail/templates'
        'templates_options' => 'ABSOLUTE => \'1\', INCLUDE_PATH => \'templates_dir\'

  ref_of_hash : formateLineHash(string:line);
         or  formateLineHash(string:line,string:motif,string:key);

     Return a anonyme reference on  hash  and may replace the motif in the value of
    key by the value of another key  :

     eg 

     my $e = $cg->{templates_options} ;
     my $opt= "templates_dir";
     my $va = $cg->{$opt};
     my $ligne= $nconfig->formateLineHash($e,$opt,$va) ;

     gives :  
      DB<1> x $ligne
     0  HASH(0x848b778)
       'ABSOLUTE' => 1
       'INCLUDE_PATH' => '/opt/apache/portail/templates'

      $ligne can be use directly like option for somes instructions

  ref_of_array : formateLineArray(string:line);
or  formateLineArray(string:line,string:motif,string:key);
    Return a anonyme reference on array and may replace the motif in the
    element by the value of another key :

      the return value can be use directly like option for somes instructions

  findParagraph(chapter[,section])
    Find and return a reference of chapter finds in xml file , a section can
    be specified.

Functions
  Lemonldap::Config::Parameters::f_delete('CONF');
     Delete the cache and the restore segment

  Lemonldap::Config::Parameters::f_reload('CONF');
     The next acces on cache will need to read file before .

  Lemonldap::Config::Parameters::f_dump('CONF');
     Dump of the config 

SOAP server facility .
     With version of Config::parameters > 0.3 we can use an unique file of configuration 
     whi can be retrieve by the lemonldap SSO boxes with SOAP agents .
     On the central server you MUST use SOAP server in combinaison with apache , mod_perl and SOAP::Lite 
     Like this :

 (httpd.conf)  
  <location /conf_lemonldap>
    Options +execcgi
    SetHandler perl-script
    PerlHandler Apache::SOAP
    PerlSetVar dispatch_to  'SOAPserver'
  </location>

Important : You MUST place SOAPserver.pm under the apache's directory :
eg : /usr/local/apache/
  
 
     In XML file config :
  
       <cache  id="config1"
            ConfigIpcKey="CONF"
            ConfigTtl ="10000000"
            LastModified='1'
            Method="SOAP" 
            SoapUri="http://www.portable.appli.cp/SOAPserver"
            SoapProxy="http://www.portable.appli.cp/conf_lemonldap"
            SoapAgent="['http://localhost/cgi-bin/refresh.cgi','http://www.portable.appli.cp/perl/refresh.cgi']"
         >

     with :SoapUri and SoapProxy : see SOAP::Lite documentation 
           SoapAgent : the list of agents CGI  on lemonldap server who must to be call in the case of modification

      After that agent receive notification , they do a soap request upon the administration server  for reload the lastnew config .
      If it's fail , slave lemonldap uses a local file XML which is the lastest copy of file config .

     An agent lemonldap MAY to be in same server that the SOAP manager. So SOAP manager uses 'conf' instead 'CONF' for the IPC glue .
     It 'll be two IPC segments 'CONF' and 'conf'  'CONF' for agent 'conf' for SOAP server ,but don't worry it's an internal process ,
     stay to use 'CONF' .

SEE ALSO
    Lemonldap(3), Lemonldap::Portal::Standard

    http://lemonldap.sourceforge.net/

    "Writing Apache Modules with Perl and C" by Lincoln Stein & Doug
    MacEachern - O'REILLY

     See the examples directory

AUTHORS
    Eric German, <germanlinux@yahoo.fr>
    Xavier Guimard, <x.guimard@free.fr>

COPYRIGHT AND LICENSE
    Copyright (C) 2004 by Eric German & Xavier Guimard

    Lemonldap originaly written by Eric german who decided to publish him in
    2003 under the terms of the GNU General Public License version 2.

    This package is under the GNU General Public License, Version 2.
    The primary copyright holder is Eric German.
    Portions are copyrighted under the same license as Perl itself.
    Portions are copyrighted by Doug MacEachern and Lincoln Stein. This
    library is under the GNU General Public License, Version 2.
      This program is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
      the Free Software Foundation; version 2 dated June, 1991.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.

      A copy of the GNU General Public License is available in the source tree;
      if not, write to the Free Software Foundation, Inc.,
      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

