Revision: | 1.5 |
Committed: | Fri Dec 14 09:03:43 2007 UTC (17 years, 5 months ago) by muzaffar |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | V1_2_1b, V1_2_1a, V1_2_3, V1_2_2, V1_2_2_relcand2, V1_2_1, V1_2_0, V1_2_0-cand11, V1_1_7, V1_1_6, V1_2_0-cand10, V1_1_5, V1_2_0-cand9, V1_2_0-cand8, V1_2_0-cand7, V1_2_0-cand6, V1_2_0-cand5, V1_2_0-cand4, V1_2_0-cand3, V1_2_0-cand2, V1_2_0-cand1, V1_1_4, V1_1_3, V1_1_2, V1_1_0_reltag8, V1_1_0_reltag7, V1_1_0_reltag6, V1_1_1, V1_1_0_reltag5, V1_1_0_reltag4, V1_1_0_reltag3, V1_1_0_reltag2, V1_1_0_reltag1, V1_1_0_reltag, V1_1_0_cand3, V1_1_0_cand2, V1_1_0_cand1 |
Branch point for: | forBinLess_SCRAM |
Changes since 1.4: | +4 -1 lines |
Log Message: | replace head with xml branch |
# | 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 | muzaffar | 1.5 | |
60 | # dont propogate a destroy method | ||
61 | williamc | 1.2 | return if $AUTOLOAD=~/::DESTROY$/; |
62 | muzaffar | 1.5 | |
63 | williamc | 1.2 | ($call=$AUTOLOAD)=~s/^.*:://; |
64 | muzaffar | 1.5 | # print "Calling $call from ".$self->{objectstore}."\n"; |
65 | williamc | 1.2 | return $self->{objectstore}->$call(@_); |
66 | } |