1 |
## ------------------------------------------------------------------------- |
2 |
## $Id: Rap.pm,v 1.1 2003/02/18 15:34:26 joko Exp $ |
3 |
## ------------------------------------------------------------------------- |
4 |
## $Log: Rap.pm,v $ |
5 |
## Revision 1.1 2003/02/18 15:34:26 joko |
6 |
## + initial commit |
7 |
## |
8 |
## ------------------------------------------------------------------------- |
9 |
|
10 |
|
11 |
=pod |
12 |
|
13 |
=head1 Preface |
14 |
|
15 |
=head2 hmm..... |
16 |
|
17 |
A Command is a Request. |
18 |
A Task is a Process. |
19 |
A Request is a Command. |
20 |
A Process is a Task. |
21 |
There are just details. |
22 |
|
23 |
=head2 ahh... |
24 |
|
25 |
CPAN already *has got* all the tools starting an attempt to do this. |
26 |
|
27 |
Having enough experience with Perl now, this attempt should work out well..... |
28 |
But still, Hmmm...... |
29 |
And: lots of work, i believe.... |
30 |
|
31 |
Okay: |
32 |
Look at DesignPattern:: and Data::Transform::Deep & Co. (lowlevel stuff) |
33 |
or OEF::, Data::Storage and Data::Transfer::Sync (highlevel stuff). |
34 |
|
35 |
And then: |
36 |
|
37 |
|
38 |
=head1 Overview |
39 |
|
40 |
=head2 Rap - Request And Process |
41 |
|
42 |
|
43 |
=head3 Rap's aims are directed to get some of this together |
44 |
|
45 |
- some concepts of make (->targets) |
46 |
- some concepts of ant (->tasks) |
47 |
- some code written while developing a custom application with Perl: |
48 |
- libraries/modules (CPAN proposals) |
49 |
- Data::Storage::Container |
50 |
- Data::Storage |
51 |
- Data::Transfer::Sync |
52 |
- OEF::Component::Task |
53 |
- make "old" shortcut programs like "feed.pl", "tell.pl" and such obsolete |
54 |
- add more targets in order to make "setup.pl" & Co. obsolete as well |
55 |
|
56 |
|
57 |
=head3 It's using these fine modules from CPAN |
58 |
|
59 |
- xml, xpath and such (XML::Parser, XML::XPath) |
60 |
- local os native (background) process execution (IPC::Run) |
61 |
- remote procedure calls with xml payloads: XMLRPC, SOAP and such (RPC::XML, SOAP::Lite) |
62 |
- configuration- and property-data inheritance: Hash::Merge |
63 |
|
64 |
- under the hood: |
65 |
- logging: Log::Dispatch |
66 |
- data-access: DBI & Co., Tangram |
67 |
- data-manipulation: Data::Dumper, Iterate |
68 |
- in other words: all modules already included in some declaration inside 'setup.pl' |
69 |
|
70 |
|
71 |
=head3 Rap does networking |
72 |
|
73 |
- It's a client. (cli program, standalone) |
74 |
- It's a server/daemon as well. (cli interacts with daemon via tcp-socket) |
75 |
|
76 |
|
77 |
=head3 Rap is open for enhancements and/or integration into/with other stuff |
78 |
|
79 |
=head4 Command-Frontends (local and/or remote) |
80 |
|
81 |
o Commands can be sent via psh (The Perl Shell) or similar frontends (via rap.pl or Rap.pm) |
82 |
o Commands can be issued from a php-frontend (via RPC using Rap::) |
83 |
|
84 |
=head4 Target-Registry (local and/or remote) |
85 |
|
86 |
x Targets can be defined inside a rap.xml or similar |
87 |
o Targets can be stored in arbitrary data structures (e.g. read from an rdbms or ldap-storage) |
88 |
|
89 |
=head4 Task-Backends (local and/or remote) |
90 |
|
91 |
x Tasks can run as local native processes (attached and/or background) |
92 |
o Tasks can be triggered by issuing RPC-calls to arbitrary multiple hosts |
93 |
|
94 |
=head4 TODO |
95 |
o look at Maven's POM (Project Object Model): |
96 |
- http://jakarta.apache.org/turbine/maven/reference/project-descriptor.html |
97 |
- http://jakarta.apache.org/turbine/maven/images/project-descriptor.gif |
98 |
- http://jakarta.apache.org/turbine/maven/start/integrate.html |
99 |
- http://jakarta.apache.org/turbine/maven/reference/dirlayout.html |
100 |
o integrate with: |
101 |
o POE |
102 |
o PP5E |
103 |
o integrate with pod (for reporting purposes) |
104 |
o look at: |
105 |
btw: "expand": look at scripts@CPAN (System Administration): |
106 |
there is a perl make with perl |
107 |
o refactore child-modules using code from Data::Code only! |
108 |
|
109 |
|
110 |
=cut |
111 |
|
112 |
|
113 |
package Data::Rap; |
114 |
|
115 |
use strict; |
116 |
use warnings; |
117 |
|
118 |
use base qw( |
119 |
DesignPattern::Object |
120 |
DesignPattern::Bridge |
121 |
Log::Dispatch::Config::Object |
122 |
); |
123 |
|
124 |
|
125 |
use Data::Dumper; |
126 |
|
127 |
|
128 |
sub constructor { |
129 |
my $self = shift; |
130 |
$self->load([qw( Metadata Engine Property Command )]); |
131 |
#$self->load("Command"); |
132 |
#$self->load("Metadata"); |
133 |
#$self->load("Engine"); |
134 |
|
135 |
} |
136 |
|
137 |
sub start { |
138 |
my $self = shift; |
139 |
$self->log("starting", 'info'); |
140 |
|
141 |
$self->loadGlobalProperties(); |
142 |
|
143 |
#print Dumper($self); |
144 |
if (my $target = $self->{target}) { |
145 |
#$self->{targets}->{$target} = Data::Rap::Target->new( name => $target ); |
146 |
$self->log("target: $target", 'info'); |
147 |
$self->performTarget($target); |
148 |
} else { |
149 |
my $meta_raw = $self->readXmlOverview(); |
150 |
#print Dumper($meta_raw); |
151 |
foreach my $key (keys %{$meta_raw->{target}}) { |
152 |
my $target = $meta_raw->{target}->{$key}; |
153 |
print " - rap.pl $key", "\n"; |
154 |
my $description = $target->{description}; |
155 |
if ($description) { |
156 |
#chomp($description); |
157 |
$description =~ s/^\n+//; |
158 |
$description =~ s/\n+$//; |
159 |
#print "\n" if $description !~ /^\n/; |
160 |
print $description, "\n" if !ref $description; |
161 |
} |
162 |
#print "\n"; |
163 |
} |
164 |
} |
165 |
|
166 |
} |
167 |
|
168 |
1; |
169 |
__END__ |