/[cvs]/nfo/perl/libs/Data/Rap.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Rap.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by joko, Tue Feb 18 16:02:04 2003 UTC revision 1.3 by joko, Thu Feb 20 18:44:26 2003 UTC
# Line 2  Line 2 
2  ##  $Id$  ##  $Id$
3  ## -------------------------------------------------------------------------  ## -------------------------------------------------------------------------
4  ##  $Log$  ##  $Log$
5    ##  Revision 1.3  2003/02/20 18:44:26  joko
6    ##  renamed modules
7    ##  + sub find_rules: attempts to find 'rap.xml'
8    ##  + updated documentation: added SYNOPSIS
9    ##
10  ##  Revision 1.2  2003/02/18 16:02:04  joko  ##  Revision 1.2  2003/02/18 16:02:04  joko
11  ##  +- renamed module  ##  +- renamed module
12  ##  ##
# Line 38  Line 43 
43    And then:    And then:
44    
45    
46    =head1 SYNOPSIS
47    
48      my $rap = Data::Rap->new( target => 'sync-core' );
49      $rap->start();
50    
51      print Dumper($rap);
52      
53      print Dumper($rap->get_property('/'));
54    
55      print Dumper($rap->get_property('.'));
56      print Dumper($rap->get_property('global'));
57      print Dumper($rap->get_property('app'));
58      print Dumper($rap->get_property('app.config'));
59      print Dumper($rap->get_property('app.config.preboot'));
60      print Dumper($rap->get_property('app.config.databases.oefcore'));
61    
62    
63  =head1 Overview  =head1 Overview
64    
65  =head2 Rap - Request And Process  =head2 Rap - Request And Process
# Line 55  Line 77 
77         - OEF::Component::Task         - OEF::Component::Task
78      - make "old" shortcut programs like "feed.pl", "tell.pl" and such obsolete      - make "old" shortcut programs like "feed.pl", "tell.pl" and such obsolete
79      - 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
80      - some new concepts (perly):
81        - namespaces
82        - plugins
83        - contexts
84    
85    
86  =head3 It's using these fine modules from CPAN  =head3 It's using these fine modules from CPAN
# Line 73  Line 99 
99    
100  =head3 Rap does networking  =head3 Rap does networking
101    
102    - It's a client. (cli program, standalone)    x It's a client. (cli program, standalone)
103    - It's a server/daemon as well. (cli interacts with daemon via tcp-socket)        (->Command-Frontends: rap.pl)
104      o It's a server/daemon as well. (cli interacts with daemonized engine via tcp-socket)
105          (->Command-Frontends: rap.pl --remote|--host=<hostname>)
106    
107        
108  =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
109    
110  =head4 Command-Frontends (local and/or remote)  =head4 Command-Frontends (local and/or remote)
111    
112      x rap.pl
113    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)
114    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::)
115    
# Line 121  use warnings; Line 150  use warnings;
150  use base qw(  use base qw(
151    DesignPattern::Object    DesignPattern::Object
152    DesignPattern::Bridge    DesignPattern::Bridge
153    Log::Dispatch::Config::Object    DesignPattern::Logger
154      DesignPattern::Exception
155  );  );
156    
157    
158  use Data::Dumper;  use Data::Dumper;
159    use Cwd;
160    use File::Spec::Functions qw( splitpath splitdir catpath catdir );
161    
162    
163  sub constructor {  sub constructor {
164    my $self = shift;    my $self = shift;
165    $self->load([qw( Metadata Engine Property Command )]);    
166      # patch
167        $self->{__rap}->{filename} = $self->{filename};
168        delete $self->{filename};
169      
170      # check
171        if (!$self->{__rap}->{filename}) {
172          $self->{__rap}->{filename} = $self->find_rules();
173        }
174      
175      $self->load([qw( Metadata Engine Command Context Property )]);
176    #$self->load("Command");    #$self->load("Command");
177    #$self->load("Metadata");    #$self->load("Metadata");
178    #$self->load("Engine");    #$self->load("Engine");
# Line 149  sub start { Line 191  sub start {
191      $self->log("target: $target", 'info');      $self->log("target: $target", 'info');
192      $self->performTarget($target);      $self->performTarget($target);
193    } else {    } else {
194      my $meta_raw = $self->readXmlOverview();      my $meta_raw = $self->getTargetList();
195      #print Dumper($meta_raw);  
196        foreach my $entry (@$meta_raw) {
197          print "  - rap.pl $entry->{name}", "\n";
198          print $entry->{description}, "\n" if $entry->{description};
199        }
200    
201        return;
202    
203        print Dumper($meta_raw);
204        exit;
205        
206      foreach my $key (keys %{$meta_raw->{target}}) {      foreach my $key (keys %{$meta_raw->{target}}) {
207        my $target = $meta_raw->{target}->{$key};        my $target = $meta_raw->{target}->{$key};
208        print "  - rap.pl $key", "\n";        print "  - rap.pl $key", "\n";
# Line 168  sub start { Line 220  sub start {
220        
221  }  }
222    
223    sub find_rules {
224      my $self = shift;
225      my $cwd = cwd();
226    
227      (my $volume, my $directory, my $file) = splitpath( $cwd );
228      my @dir = splitdir($directory);
229      pop @dir;
230      #pop @dir;
231      my $base = catpath($volume, catdir(@dir));
232    
233      my $rap_xml = "$base/etc/rap.xml";
234      return $rap_xml;
235    }
236    
237    
238  1;  1;
239  __END__  __END__

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed