--- nfo/perl/libs/Data/Rap.pm 2003/02/20 18:44:26 1.3 +++ nfo/perl/libs/Data/Rap.pm 2003/03/29 07:08:56 1.6 @@ -1,7 +1,18 @@ ## ------------------------------------------------------------------------- -## $Id: Rap.pm,v 1.3 2003/02/20 18:44:26 joko Exp $ +## $Id: Rap.pm,v 1.6 2003/03/29 07:08:56 joko Exp $ ## ------------------------------------------------------------------------- ## $Log: Rap.pm,v $ +## Revision 1.6 2003/03/29 07:08:56 joko +## rap goes global: +## + distinguish between running in global- or project-mode +## + some comments in pod +## +## Revision 1.5 2003/03/28 16:52:41 jonen +## now using env-var 'RAPBIN' +## +## Revision 1.4 2003/03/27 15:31:01 joko +## fixes to modules regarding new namespace(s) below Data::Mungle::* +## ## Revision 1.3 2003/02/20 18:44:26 joko ## renamed modules ## + sub find_rules: attempts to find 'rap.xml' @@ -28,16 +39,23 @@ A Process is a Task. There are just details. + =head2 ahh... - CPAN already *has got* all the tools starting an attempt to do this. + rap means 'Request And Process'. + rap is contained in 'wrapped'. + dot is the 'Database Of Targets', by default '/etc/rap.xml'. (rename to 'dot.xml'?) + + + CPAN already *has got* all required tools starting an attempt to do this. - Having enough experience with Perl now, this attempt should work out well..... + Will this work out? But still, Hmmm...... And: lots of work, i believe.... + Let's start... Okay: - Look at DesignPattern:: and Data::Transform::Deep & Co. (lowlevel stuff) + Look at DesignPattern:: and Data::Mungle::Transform::Deep & Co. (lowlevel stuff) or OEF::, Data::Storage and Data::Transfer::Sync (highlevel stuff). And then: @@ -64,6 +82,46 @@ =head2 Rap - Request And Process +=head3 Rap's Features + - have targets (like make) declared in xml (like ant) + - run these targets... + - ... from a multitude of possible human interaction devices (HIDs), e.g. + - cli (console mode) + - gui + - web + - speech + - scribe + - ... from a different location (non-local - for remote administration purposes) + - the remote wrapper is 'rapd' - the rap-daemon.... + - rapd can run in command-mode (like apache, sendmail and related) + and/or web-service mode (commands are wrapped into request-/response- + xml-payload-communication) + - rap is self contained on various levels + - runtime-layer + - pass arguments between targets + - core targets are declared in xml (rap-lingo) as well + these exist by now: (look at Data/Rap/targets/default.xml) + - core.os.win32 + - core.os.linux + - core.rap.mode + - core.rap.daemon + - declaration-layer + - the xml-file in rap-lingo can contain descriptions associated with each target + - rap can make report on its guis about these + - rap can use this declaration as an api for the rap-daemon 'rapd' + - rap itself can run in "global"- or "project"-mode + - FIXME: write something about this (by now: read the source, luke.....) + + +=head3 Rap's Future + - rapd + - rapd can also run in apache mode for non-root purposes + - many rapd's can talk to each other - first example application would be: + - one rapd is running as apache-mod-perl-handler (non-root) + - one rapd is running locally as root + - remark: the way to go (by now) is via org.netfrag.glib's DataSource-libraries, + which wrap the innards of rpc-communication via xml (XMLRPC) (lingo: php) + an example application is caesar.rapweb and (maybe) caesar.ums =head3 Rap's aims are directed to get some of this together @@ -176,7 +234,7 @@ #$self->load("Command"); #$self->load("Metadata"); #$self->load("Engine"); - + } sub start { @@ -222,16 +280,55 @@ sub find_rules { my $self = shift; - my $cwd = cwd(); - (my $volume, my $directory, my $file) = splitpath( $cwd ); - my @dir = splitdir($directory); - pop @dir; - #pop @dir; - my $base = catpath($volume, catdir(@dir)); + my $rapfile = 'etc/rap.xml'; + my $rapfile_found = ''; + + my $basedir = ''; + + # directly from env-var? + if (my $rapdir = $ENV{RAPDIR}) { + $basedir = $rapdir; + + # relative? + } else { + my $cwd = cwd(); + + (my $volume, my $directory, my $file) = splitpath( $cwd ); + + my @dir = splitdir($directory); + pop @dir; + #pop @dir; + $basedir = catpath($volume, catdir(@dir)); + + } + + #print "basedir: '$basedir'", "\n"; + + # check for $basedir/PROJECT + if (! -d "$basedir/PROJECT") { + $basedir = ''; + } + + if ($basedir) { + # TODO: review this! handle relative ./etc/rap.xml here!!! + $rapfile_found = "$basedir/$rapfile"; + + } else { + #if (! -e $rapfile_found) { $rapfile_found = "/$rapfile"; } + $rapfile_found = "/$rapfile"; + } + + #print "rapfile_found: $rapfile_found", "\n"; + + + # if rapfile doesn't exists, try to fall back to absolute (global) mode (/etc/rap.xml) + #if (! -e $rapfile_found) { $rapfile_found = catpath($volume, "/", $rapfile); } + #if (! -e $rapfile_found) { $rapfile_found = "/$rapfile"; } + + $self->log( "Using rapfile $rapfile_found.", 'info' ); - my $rap_xml = "$base/etc/rap.xml"; - return $rap_xml; + return $rapfile_found; }