ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Configuration/ConfigArea.pm
(Generate patch)

Comparing COMP/SCRAM/src/Configuration/ConfigArea.pm (file contents):
Revision 1.3 by williamc, Fri Jan 21 08:59:34 2000 UTC vs.
Revision 1.4 by williamc, Fri Jan 21 11:56:38 2000 UTC

# Line 18 | Line 18
18   # addconfigitem(url)            : add a new item to the area
19   # configitem(@keys)             : return a list of fig items that match
20   #                                 the keys - all if left blank
21 + # parentstore()                 : set/return the parent ObjectStore
22  
23   package Configuration::ConfigArea;
24   use ActiveDoc::ActiveDoc;
# Line 57 | Line 58 | sub setup {
58          }
59          $self->location($location."/".$name);
60  
60
61          # make a new store handler
62 <        my $parentconfig=$self->_setupstore();
62 >        $self->_setupstore();
63  
64          # --- download everything first
65   # FIX-ME --- cacheing is broken
# Line 69 | Line 69 | sub setup {
69          $self->parse("setup");
70          
71          # --- store self in original database
72 <        $parentconfig->store($self,"ConfigArea",$self->name(),
72 >        $self->parentconfig()->store($self,"ConfigArea",$self->name(),
73                                                          $self->version());
74   }
75  
# Line 79 | Line 79 | sub _setupstore {
79          # --- make a new ActiveStore at the location and add it to the db list
80          my $ad=ActiveDoc::ActiveConfig->new($self->location()."/\.SCRAM");
81  
82 <        my $parentconfig=$self->config();
83 <        $self->config(Configuration::ConfigureStore->new());
84 <        $self->config()->db("local",$ad);
85 <        $self->config()->db("parent",$parentconfig);
86 <        $self->config()->policy("cache","local");
87 <        $self->config()->basedoc($parentconfig->basedoc());
88 <        return $parentconfig;
82 >        $self->parentconfig($self->config());
83 > #        $self->config(Configuration::ConfigureStore->new());
84 > #        $self->config()->db("local",$ad);
85 > #        $self->config()->db("parent",$self->parentconfig());
86 > #        $self->config()->policy("cache","local");
87 >        $self->config($ad);
88 >        $self->config()->basedoc($self->parentconfig()->basedoc());
89 > }
90 >
91 > sub parentconfig {
92 >        my $self=shift;
93 >        @_?$self->{parentconfig}=shift
94 >          :$self->{parentconfig};
95   }
96  
97   sub store {
# Line 93 | Line 99 | sub store {
99          my $location=shift;
100  
101          my $fh=$self->openfile(">".$location);
102 <        print $fh $self->location()."\n";
102 >        $self->savevar($fh,"location", $self->location());
103 >        $self->savevar($fh,"url", $self->url());
104 >        $self->savevar($fh,"name", $self->name());
105 >        $self->savevar($fh,"version", $self->version());
106          $fh->close();
107   }
108  
109   sub restore {
110          my $self=shift;
111 +        my $location=shift;
112  
113          my $fh=$self->openfile("<".$location);
114 <        $self->{location}=<$fh>;
115 <        chomp $self->{location};
114 >        my $varhash={};
115 >        $self->restorevars($fh,$varhash);
116 >        $self->location($$varhash{"location"});
117 >        $self->_setupstore();
118 >        $self->url($$varhash{"url"});
119 >        $self->name($$varhash{"name"});
120 >        $self->version($$varhash{"version"});
121          $fh->close();
107
122   }
123  
124   sub name {
# Line 149 | Line 163 | sub addconfigitem {
163          my $docref=$self->activatedoc($url);
164          # Set up the document
165          $docref->setup();
166 <        $self->config()->storepolicy("local");
166 > #       $self->config()->storepolicy("local");
167          $docref->save();
168   }
169  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines