2 |
## $Id$ |
## $Id$ |
3 |
## ------------------------------------------------------------------------- |
## ------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.5 2003/03/28 16:52:41 jonen |
6 |
|
## now using env-var 'RAPBIN' |
7 |
|
## |
8 |
|
## Revision 1.4 2003/03/27 15:31:01 joko |
9 |
|
## fixes to modules regarding new namespace(s) below Data::Mungle::* |
10 |
|
## |
11 |
|
## Revision 1.3 2003/02/20 18:44:26 joko |
12 |
|
## renamed modules |
13 |
|
## + sub find_rules: attempts to find 'rap.xml' |
14 |
|
## + updated documentation: added SYNOPSIS |
15 |
|
## |
16 |
## Revision 1.2 2003/02/18 16:02:04 joko |
## Revision 1.2 2003/02/18 16:02:04 joko |
17 |
## +- renamed module |
## +- renamed module |
18 |
## |
## |
43 |
And: lots of work, i believe.... |
And: lots of work, i believe.... |
44 |
|
|
45 |
Okay: |
Okay: |
46 |
Look at DesignPattern:: and Data::Transform::Deep & Co. (lowlevel stuff) |
Look at DesignPattern:: and Data::Mungle::Transform::Deep & Co. (lowlevel stuff) |
47 |
or OEF::, Data::Storage and Data::Transfer::Sync (highlevel stuff). |
or OEF::, Data::Storage and Data::Transfer::Sync (highlevel stuff). |
48 |
|
|
49 |
And then: |
And then: |
50 |
|
|
51 |
|
|
52 |
|
=head1 SYNOPSIS |
53 |
|
|
54 |
|
my $rap = Data::Rap->new( target => 'sync-core' ); |
55 |
|
$rap->start(); |
56 |
|
|
57 |
|
print Dumper($rap); |
58 |
|
|
59 |
|
print Dumper($rap->get_property('/')); |
60 |
|
|
61 |
|
print Dumper($rap->get_property('.')); |
62 |
|
print Dumper($rap->get_property('global')); |
63 |
|
print Dumper($rap->get_property('app')); |
64 |
|
print Dumper($rap->get_property('app.config')); |
65 |
|
print Dumper($rap->get_property('app.config.preboot')); |
66 |
|
print Dumper($rap->get_property('app.config.databases.oefcore')); |
67 |
|
|
68 |
|
|
69 |
=head1 Overview |
=head1 Overview |
70 |
|
|
71 |
=head2 Rap - Request And Process |
=head2 Rap - Request And Process |
83 |
- OEF::Component::Task |
- OEF::Component::Task |
84 |
- make "old" shortcut programs like "feed.pl", "tell.pl" and such obsolete |
- make "old" shortcut programs like "feed.pl", "tell.pl" and such obsolete |
85 |
- add more targets in order to make "setup.pl" & Co. obsolete as well |
- add more targets in order to make "setup.pl" & Co. obsolete as well |
86 |
|
- some new concepts (perly): |
87 |
|
- namespaces |
88 |
|
- plugins |
89 |
|
- contexts |
90 |
|
|
91 |
|
|
92 |
=head3 It's using these fine modules from CPAN |
=head3 It's using these fine modules from CPAN |
105 |
|
|
106 |
=head3 Rap does networking |
=head3 Rap does networking |
107 |
|
|
108 |
- It's a client. (cli program, standalone) |
x It's a client. (cli program, standalone) |
109 |
- It's a server/daemon as well. (cli interacts with daemon via tcp-socket) |
(->Command-Frontends: rap.pl) |
110 |
|
o It's a server/daemon as well. (cli interacts with daemonized engine via tcp-socket) |
111 |
|
(->Command-Frontends: rap.pl --remote|--host=<hostname>) |
112 |
|
|
113 |
|
|
114 |
=head3 Rap is open for enhancements and/or integration into/with other stuff |
=head3 Rap is open for enhancements and/or integration into/with other stuff |
115 |
|
|
116 |
=head4 Command-Frontends (local and/or remote) |
=head4 Command-Frontends (local and/or remote) |
117 |
|
|
118 |
|
x rap.pl |
119 |
o Commands can be sent via psh (The Perl Shell) or similar frontends (via rap.pl or Rap.pm) |
o Commands can be sent via psh (The Perl Shell) or similar frontends (via rap.pl or Rap.pm) |
120 |
o Commands can be issued from a php-frontend (via RPC using Rap::) |
o Commands can be issued from a php-frontend (via RPC using Rap::) |
121 |
|
|
156 |
use base qw( |
use base qw( |
157 |
DesignPattern::Object |
DesignPattern::Object |
158 |
DesignPattern::Bridge |
DesignPattern::Bridge |
159 |
Log::Dispatch::Config::Object |
DesignPattern::Logger |
160 |
|
DesignPattern::Exception |
161 |
); |
); |
162 |
|
|
163 |
|
|
164 |
use Data::Dumper; |
use Data::Dumper; |
165 |
|
use Cwd; |
166 |
|
use File::Spec::Functions qw( splitpath splitdir catpath catdir ); |
167 |
|
|
168 |
|
|
169 |
sub constructor { |
sub constructor { |
170 |
my $self = shift; |
my $self = shift; |
171 |
$self->load([qw( Metadata Engine Property Command )]); |
|
172 |
|
# patch |
173 |
|
$self->{__rap}->{filename} = $self->{filename}; |
174 |
|
delete $self->{filename}; |
175 |
|
|
176 |
|
# check |
177 |
|
if (!$self->{__rap}->{filename}) { |
178 |
|
$self->{__rap}->{filename} = $self->find_rules(); |
179 |
|
} |
180 |
|
|
181 |
|
$self->load([qw( Metadata Engine Command Context Property )]); |
182 |
#$self->load("Command"); |
#$self->load("Command"); |
183 |
#$self->load("Metadata"); |
#$self->load("Metadata"); |
184 |
#$self->load("Engine"); |
#$self->load("Engine"); |
185 |
|
|
186 |
|
# check for another environment-variable: 'RAPBIN' |
187 |
|
chdir $ENV{RAPBIN} if $ENV{RAPBIN}; |
188 |
|
|
189 |
} |
} |
190 |
|
|
200 |
$self->log("target: $target", 'info'); |
$self->log("target: $target", 'info'); |
201 |
$self->performTarget($target); |
$self->performTarget($target); |
202 |
} else { |
} else { |
203 |
my $meta_raw = $self->readXmlOverview(); |
my $meta_raw = $self->getTargetList(); |
204 |
#print Dumper($meta_raw); |
|
205 |
|
foreach my $entry (@$meta_raw) { |
206 |
|
print " - rap.pl $entry->{name}", "\n"; |
207 |
|
print $entry->{description}, "\n" if $entry->{description}; |
208 |
|
} |
209 |
|
|
210 |
|
return; |
211 |
|
|
212 |
|
print Dumper($meta_raw); |
213 |
|
exit; |
214 |
|
|
215 |
foreach my $key (keys %{$meta_raw->{target}}) { |
foreach my $key (keys %{$meta_raw->{target}}) { |
216 |
my $target = $meta_raw->{target}->{$key}; |
my $target = $meta_raw->{target}->{$key}; |
217 |
print " - rap.pl $key", "\n"; |
print " - rap.pl $key", "\n"; |
229 |
|
|
230 |
} |
} |
231 |
|
|
232 |
|
sub find_rules { |
233 |
|
my $self = shift; |
234 |
|
|
235 |
|
my $basedir; |
236 |
|
if (my $rapdir = $ENV{RAPDIR}) { |
237 |
|
$basedir = $rapdir; |
238 |
|
} else { |
239 |
|
my $cwd = cwd(); |
240 |
|
|
241 |
|
(my $volume, my $directory, my $file) = splitpath( $cwd ); |
242 |
|
my @dir = splitdir($directory); |
243 |
|
pop @dir; |
244 |
|
#pop @dir; |
245 |
|
$basedir = catpath($volume, catdir(@dir)); |
246 |
|
|
247 |
|
} |
248 |
|
|
249 |
|
my $rap_xml = "$basedir/etc/rap.xml"; |
250 |
|
return $rap_xml; |
251 |
|
} |
252 |
|
|
253 |
|
|
254 |
1; |
1; |
255 |
__END__ |
__END__ |