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.1 by williamc, Thu Jan 20 18:21:54 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        # --- make a new ActiveStore at the location and add it to the db list
61        my $ad=ActiveDoc::ActiveConfig->new($self->location()."/\.SCRAM");
62
61          # make a new store handler
62 <        my $parentconfig=$self->config;
65 <        $self->config(Configuration::ConfigureStore);
66 <        $self->config()->db("local",$ad);
67 <        $self->config()->db("parent",$parentconfig);
68 <        $self->config()->policy("cache","local");
69 <        $self->config()->basedoc($parentconfig->basedoc());
62 >        $self->_setupstore();
63  
64          # --- download everything first
65   # FIX-ME --- cacheing is broken
66 < #       $self->parse("download");
66 >        $self->parse("download");
67          
68          # --- and parse the setup file
69          $self->parse("setup");
70 +        
71 +        # --- store self in original database
72 +        $self->parentconfig()->store($self,"ConfigArea",$self->name(),
73 +                                                        $self->version());
74 + }
75 +
76 + sub _setupstore {
77 +        my $self=shift;
78 +
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 +        $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 81 | 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();
95
122   }
123  
124   sub name {
# Line 137 | Line 163 | sub addconfigitem {
163          my $docref=$self->activatedoc($url);
164          # Set up the document
165          $docref->setup();
166 <        $self->config()->savepolicy("local");
166 > #       $self->config()->storepolicy("local");
167          $docref->save();
168   }
169  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines