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