since pluggable store landed in trunk add --store-path and --store-module options
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 27 Oct 2007 23:06:09 +0000 (23:06 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 27 Oct 2007 23:06:09 +0000 (23:06 +0000)
git-svn-id: https://perl-cwmp.googlecode.com/svn/trunk@163 836a5e1a-633d-0410-964b-294494ad4392

bin/acs.pl
bin/cli.pl

index 6956123..ddfa2b8 100755 (executable)
@@ -12,18 +12,22 @@ use Getopt::Long;
 
 my $port = 3333;
 my $debug = 0;
+my $store_path = './';
+my $store_plugin = 'YAML';
 
 GetOptions(
        'debug+' => \$debug,
        'port=i' => \$port,
+       'store-path=s' => \$store_path,
+       'store-plugin=s' => \$store_plugin,
 );
 
 my $server = CWMP::Server->new({
        port => $port,
        store => {
-#              module => 'DBMDeep',
-               module => 'YAML',
-               store_path => 'state.db',
+               module => $store_plugin,
+               path => $store_path,
+               debug => $debug,
        },
        debug => $debug,
        default_queue => [ qw/
index b00088e..b9c3733 100755 (executable)
@@ -14,19 +14,22 @@ use Getopt::Long;
 use Carp qw/confess/;
 
 my $debug = 0;
-my $store_path = 'state.db';
+my $store_path = './';
+my $store_plugin = 'YAML';
 
 GetOptions(
        'debug+' => \$debug,
        'store-path=s' => \$store_path,
+       'store-plugin=s' => \$store_plugin,
 );
 
 my $sh = Term::Shelly->new();
 my $tree = CWMP::Tree->new({ debug => $debug });
 
 our $store = CWMP::Store->new({
-       debug => $debug,
+       module => $store_plugin,
        path => $store_path,
+       debug => $debug,
 });
 
 $sh->out(
@@ -77,7 +80,7 @@ sub completer {
 
        # do we have list (part) of CPE?
        if ( $line =~ /^(\S*)\s*$/ ) {
-               @matches = sort grep { /^\Q$curword\E/ } $store->known_CPE;
+               @matches = sort grep { /^\Q$curword\E/ } $store->all_uids;
                $sh->out( "CPE available: ", join(",", @matches ) );
        } elsif ( $line =~ /^(\w+)\s+(\S+)$/ ) {
                $sh->out("finding completes for '$2'");