2 |
## $Id$ |
## $Id$ |
3 |
## ------------------------------------------------------------------------- |
## ------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.7 2003/05/13 05:52:58 joko |
6 |
|
## minor update: modified description printing logic |
7 |
|
## |
8 |
|
## Revision 1.6 2003/03/29 07:08:56 joko |
9 |
|
## rap goes global: |
10 |
|
## + distinguish between running in global- or project-mode |
11 |
|
## + some comments in pod |
12 |
|
## |
13 |
|
## Revision 1.5 2003/03/28 16:52:41 jonen |
14 |
|
## now using env-var 'RAPBIN' |
15 |
|
## |
16 |
## Revision 1.4 2003/03/27 15:31:01 joko |
## Revision 1.4 2003/03/27 15:31:01 joko |
17 |
## fixes to modules regarding new namespace(s) below Data::Mungle::* |
## fixes to modules regarding new namespace(s) below Data::Mungle::* |
18 |
## |
## |
42 |
A Process is a Task. |
A Process is a Task. |
43 |
There are just details. |
There are just details. |
44 |
|
|
45 |
|
|
46 |
=head2 ahh... |
=head2 ahh... |
47 |
|
|
48 |
CPAN already *has got* all the tools starting an attempt to do this. |
rap means 'Request And Process'. |
49 |
|
rap is contained in 'wrapped'. |
50 |
|
dot is the 'Database Of Targets', by default '/etc/rap.xml'. (rename to 'dot.xml'?) |
51 |
|
|
52 |
|
|
53 |
|
CPAN already *has got* all required tools starting an attempt to do this. |
54 |
|
|
55 |
Having enough experience with Perl now, this attempt should work out well..... |
Will this work out? |
56 |
But still, Hmmm...... |
But still, Hmmm...... |
57 |
And: lots of work, i believe.... |
And: lots of work, i believe.... |
58 |
|
Let's start... |
59 |
|
|
60 |
Okay: |
Okay: |
61 |
Look at DesignPattern:: and Data::Mungle::Transform::Deep & Co. (lowlevel stuff) |
Look at DesignPattern:: and Data::Mungle::Transform::Deep & Co. (lowlevel stuff) |
85 |
|
|
86 |
=head2 Rap - Request And Process |
=head2 Rap - Request And Process |
87 |
|
|
88 |
|
=head3 Rap's Features |
89 |
|
- have targets (like make) declared in xml (like ant) |
90 |
|
- run these targets... |
91 |
|
- ... from a multitude of possible human interaction devices (HIDs), e.g. |
92 |
|
- cli (console mode) |
93 |
|
- gui |
94 |
|
- web |
95 |
|
- speech |
96 |
|
- scribe |
97 |
|
- ... from a different location (non-local - for remote administration purposes) |
98 |
|
- the remote wrapper is 'rapd' - the rap-daemon.... |
99 |
|
- rapd can run in command-mode (like apache, sendmail and related) |
100 |
|
and/or web-service mode (commands are wrapped into request-/response- |
101 |
|
xml-payload-communication) |
102 |
|
- rap is self contained on various levels |
103 |
|
- runtime-layer |
104 |
|
- pass arguments between targets |
105 |
|
- core targets are declared in xml (rap-lingo) as well |
106 |
|
these exist by now: (look at Data/Rap/targets/default.xml) |
107 |
|
- core.os.win32 |
108 |
|
- core.os.linux |
109 |
|
- core.rap.mode |
110 |
|
- core.rap.daemon |
111 |
|
- declaration-layer |
112 |
|
- the xml-file in rap-lingo can contain descriptions associated with each target |
113 |
|
- rap can make report on its guis about these |
114 |
|
- rap can use this declaration as an api for the rap-daemon 'rapd' |
115 |
|
- rap itself can run in "global"- or "project"-mode |
116 |
|
- FIXME: write something about this (by now: read the source, luke.....) |
117 |
|
|
118 |
|
|
119 |
|
=head3 Rap's Future |
120 |
|
- rapd |
121 |
|
- rapd can also run in apache mode for non-root purposes |
122 |
|
- many rapd's can talk to each other - first example application would be: |
123 |
|
- one rapd is running as apache-mod-perl-handler (non-root) |
124 |
|
- one rapd is running locally as root |
125 |
|
- remark: the way to go (by now) is via org.netfrag.glib's DataSource-libraries, |
126 |
|
which wrap the innards of rpc-communication via xml (XMLRPC) (lingo: php) |
127 |
|
an example application is caesar.rapweb and (maybe) caesar.ums |
128 |
|
|
129 |
=head3 Rap's aims are directed to get some of this together |
=head3 Rap's aims are directed to get some of this together |
130 |
|
|
221 |
use File::Spec::Functions qw( splitpath splitdir catpath catdir ); |
use File::Spec::Functions qw( splitpath splitdir catpath catdir ); |
222 |
|
|
223 |
|
|
224 |
|
# a package global topic registry |
225 |
|
our $registry; |
226 |
|
|
227 |
|
|
228 |
sub constructor { |
sub constructor { |
229 |
my $self = shift; |
my $self = shift; |
230 |
|
|
241 |
#$self->load("Command"); |
#$self->load("Command"); |
242 |
#$self->load("Metadata"); |
#$self->load("Metadata"); |
243 |
#$self->load("Engine"); |
#$self->load("Engine"); |
244 |
|
|
245 |
} |
} |
246 |
|
|
247 |
sub start { |
sub start { |
258 |
} else { |
} else { |
259 |
my $meta_raw = $self->getTargetList(); |
my $meta_raw = $self->getTargetList(); |
260 |
|
|
261 |
|
my $maxlength = 0; |
262 |
|
map { |
263 |
|
my $len = length($_->{name}); |
264 |
|
$maxlength = $len if $len > $maxlength; |
265 |
|
} @$meta_raw; |
266 |
|
|
267 |
|
my $program = splitpath($0); |
268 |
foreach my $entry (@$meta_raw) { |
foreach my $entry (@$meta_raw) { |
269 |
print " - rap.pl $entry->{name}", "\n"; |
my $len = length($entry->{name}); |
270 |
print $entry->{description}, "\n" if $entry->{description}; |
#$len = ((1 / ($len / 8)) * 1.9); |
271 |
|
#$len = ((1 / ($maxlength - $len / 8)) * 1.9); |
272 |
|
$len = $maxlength - $len + 5; |
273 |
|
#print "len: $len", "\n"; |
274 |
|
# one line per target |
275 |
|
print "$program $entry->{name}", " " x $len; |
276 |
|
print $entry->{description} if $entry->{description}; |
277 |
|
print "\n"; |
278 |
|
# more lines per target |
279 |
|
#print "$program $entry->{name}", "\n"; |
280 |
|
#print " ", $entry->{description}, "\n" if $entry->{description}; |
281 |
} |
} |
282 |
|
|
283 |
return; |
return; |
304 |
|
|
305 |
sub find_rules { |
sub find_rules { |
306 |
my $self = shift; |
my $self = shift; |
|
my $cwd = cwd(); |
|
307 |
|
|
308 |
(my $volume, my $directory, my $file) = splitpath( $cwd ); |
my $rapfile = 'etc/rap.xml'; |
309 |
my @dir = splitdir($directory); |
my $rapfile_found = ''; |
310 |
pop @dir; |
|
311 |
#pop @dir; |
my $basedir = ''; |
312 |
my $base = catpath($volume, catdir(@dir)); |
|
313 |
|
# directly from env-var? |
314 |
|
if (my $rapdir = $ENV{RAPDIR}) { |
315 |
|
$basedir = $rapdir; |
316 |
|
|
317 |
|
# relative? |
318 |
|
} else { |
319 |
|
my $cwd = cwd(); |
320 |
|
|
321 |
|
(my $volume, my $directory, my $file) = splitpath( $cwd ); |
322 |
|
|
323 |
|
my @dir = splitdir($directory); |
324 |
|
pop @dir; |
325 |
|
#pop @dir; |
326 |
|
$basedir = catpath($volume, catdir(@dir)); |
327 |
|
|
328 |
|
} |
329 |
|
|
330 |
|
#print "basedir: '$basedir'", "\n"; |
331 |
|
|
332 |
|
# check for $basedir/PROJECT |
333 |
|
if (! -d "$basedir/PROJECT") { |
334 |
|
$basedir = ''; |
335 |
|
} |
336 |
|
|
337 |
|
if ($basedir) { |
338 |
|
# TODO: review this! handle relative ./etc/rap.xml here!!! |
339 |
|
$rapfile_found = "$basedir/$rapfile"; |
340 |
|
|
341 |
|
} else { |
342 |
|
#if (! -e $rapfile_found) { $rapfile_found = "/$rapfile"; } |
343 |
|
$rapfile_found = "/$rapfile"; |
344 |
|
} |
345 |
|
|
346 |
|
#print "rapfile_found: $rapfile_found", "\n"; |
347 |
|
|
348 |
|
|
349 |
|
# if rapfile doesn't exists, try to fall back to absolute (global) mode (/etc/rap.xml) |
350 |
|
#if (! -e $rapfile_found) { $rapfile_found = catpath($volume, "/", $rapfile); } |
351 |
|
#if (! -e $rapfile_found) { $rapfile_found = "/$rapfile"; } |
352 |
|
|
353 |
|
$self->log( "Using rapfile $rapfile_found.", 'info' ); |
354 |
|
|
355 |
my $rap_xml = "$base/etc/rap.xml"; |
return $rapfile_found; |
|
return $rap_xml; |
|
356 |
} |
} |
357 |
|
|
358 |
|
|