ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/ActiveDoc/ActiveStore.pm
Revision: 1.1.2.1
Committed: Thu Aug 24 10:00:13 2000 UTC (24 years, 8 months ago) by williamc
Content type: text/plain
Branch: HPWbranch
CVS Tags: V0_15_0beta
Branch point for: V0_15branch
Changes since 1.1: +65 -0 lines
Log Message:
New storage class

File Contents

# User Rev Content
1 williamc 1.1.2.1 #
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     $self->{cache}=shift;
44     }
45     else {
46     $self->error("Unable to initialise with arguments @_");
47     }
48     }
49    
50     sub cache {
51     my $self=shift;
52     return $self->{cache};
53     }
54    
55     sub AUTOLOAD { # Call any method in the ObjectStore directly
56     my $self=shift;
57     my $call;
58    
59     # dont propogate a destroy method
60     return if $AUTOLOAD=~/::DESTROY$/;
61    
62     ($call=$AUTOLOAD)=~s/^.*:://;
63     # print "Calling $call from ".$self->{objectstore}."\n";
64     return $self->{objectstore}->$call(@_);
65     }