ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/ActiveDoc/ActiveStore.pm
Revision: 1.3
Committed: Mon Oct 9 12:34:22 2000 UTC (24 years, 7 months ago) by williamc
Content type: text/plain
Branch: MAIN
CVS Tags: V1_0_3-p4, forV1_1_0, v103_xml_071106, V1_0_3-p3, V1_0_3-p2, before110xmlBRmerge, V110p2, V110p1, V1_0_4p1, V1_0_3-p1, V1_0_3, V1_0_2, V1_0_2_p1, v102p1, V1_0_1, V1_0_0, V1_pre0, SCRAM_V1, SCRAMV1_IMPORT, V0_19_7, V0_19_6, V0_19_6p1, V0_19_5, SFATEST, V0_19_4, V0_19_4_pre3, V0_19_4_pre2, V0_19_4_pre1, V0_19_3, V0_19_2, V0_19_1, V0_19_0, V0_18_5, V0_18_4, V_18_3_TEST, VO_18_3, V0_18_2, V0_18_1
Branch point for: v103_with_xml, v103_branch, V1_pre1, SCRAM_V1_BRANCH, V0_19_4_B
Changes since 1.2: +1 -0 lines
Log Message:
Import from V0_15branch - storeref method

File Contents

# User Rev Content
1 williamc 1.2 #
2     # ActiveStore.pm
3     #
4     # Originally Written by Christopher Williams
5     #
6     # Description
7     # Implements ObjectStore interface
8     #
9     # Interface
10     # ---------
11     # new([directory|[ObjectStore ObjectCache]]): A new ActiveConfig object
12     # cache() : Return the cache
13     # store(object,@keys) :
14     # find (@keys) :
15    
16     package ActiveDoc::ActiveStore;
17     require 5.004;
18     use URL::URLcache;
19     use ObjectUtilities::ObjectStore;
20     use Utilities::Verbose;
21     @ISA=qw(Utilities::Verbose);
22    
23     sub new {
24     my $class=shift;
25     $self={};
26     bless $self, $class;
27     $self->init(@_);
28     return $self;
29     }
30    
31     sub init {
32     my $self=shift;
33    
34     if ( $#_ == 0 ) {
35     my $dir=shift;
36    
37     $self->{objectstore}=ObjectUtilities::ObjectStore->
38     new($dir."/ObjectStore", $self);
39     $self->{cache}=URL::URLcache->new($dir."/cache");
40     }
41     elsif ( $#_ == 1 ) {
42     $self->{objectstore}=shift;
43 williamc 1.3 $self->{objectstore}->storeref($self);
44 williamc 1.2 $self->{cache}=shift;
45     }
46     else {
47     $self->error("Unable to initialise with arguments @_");
48     }
49     }
50    
51     sub cache {
52     my $self=shift;
53     return $self->{cache};
54     }
55    
56     sub AUTOLOAD { # Call any method in the ObjectStore directly
57     my $self=shift;
58     my $call;
59    
60     # dont propogate a destroy method
61     return if $AUTOLOAD=~/::DESTROY$/;
62    
63     ($call=$AUTOLOAD)=~s/^.*:://;
64     # print "Calling $call from ".$self->{objectstore}."\n";
65     return $self->{objectstore}->$call(@_);
66     }