line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
########################################################################### |
2
|
|
|
|
|
|
|
### Trinket::Directory::DataAccess |
3
|
|
|
|
|
|
|
### |
4
|
|
|
|
|
|
|
### Access to data storage and indexing of persistent objects. |
5
|
|
|
|
|
|
|
### |
6
|
|
|
|
|
|
|
### $Id: DataAccess.pm,v 1.2 2001/02/16 07:23:11 deus_x Exp $ |
7
|
|
|
|
|
|
|
### |
8
|
|
|
|
|
|
|
### TODO: |
9
|
|
|
|
|
|
|
### |
10
|
|
|
|
|
|
|
########################################################################### |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Trinket::Directory::DataAccess; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
15
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION @ISA @EXPORT $DESCRIPTION $AUTOLOAD); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
16
|
1
|
|
|
1
|
|
5
|
no warnings qw( uninitialized ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
59
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# {{{ Begin POD |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 NAME |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Trinket::Directory::DataAccess - Data access backend for object directory |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
TODO |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# }}} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# {{{ METADATA |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
BEGIN |
35
|
|
|
|
|
|
|
{ |
36
|
1
|
|
|
1
|
|
3
|
$VERSION = "0.0"; |
37
|
1
|
|
|
|
|
13
|
@ISA = qw( Exporter ); |
38
|
1
|
|
|
|
|
21
|
$DESCRIPTION = 'Base abstract class for data access backends'; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# }}} |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
1
|
|
5
|
use Exporter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
44
|
1
|
|
|
1
|
|
4
|
use Carp qw( croak cluck ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
129
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# {{{ METHODS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 METHODS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=over 4 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# }}} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# {{{ new(): Object constructor |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item $data = new Trinket::Directory::DataAccess::BackendName(); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Object constructor, accepts a hashref of named properties with which to |
61
|
|
|
|
|
|
|
initialize the object. In initialization, the object's set methods |
62
|
|
|
|
|
|
|
are called for each of initializing properties passed. ' |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub new |
67
|
|
|
|
|
|
|
{ |
68
|
6
|
|
|
6
|
1
|
12
|
my $class = shift; |
69
|
|
|
|
|
|
|
|
70
|
6
|
|
|
|
|
12
|
my $self = {}; |
71
|
|
|
|
|
|
|
|
72
|
6
|
|
|
|
|
16
|
bless($self, $class); |
73
|
6
|
|
|
|
|
32
|
$self->init(@_); |
74
|
6
|
|
|
|
|
18
|
return $self; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# }}} |
78
|
|
|
|
|
|
|
# {{{ init(): Object initializer |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub init |
81
|
|
|
|
|
|
|
{ |
82
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
909
|
|
83
|
0
|
|
|
0
|
0
|
|
my ($self, $props) = @_; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# }}} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# {{{ create() |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item $dir->create($params) |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Create a new object directory, destroys any existing directory |
94
|
|
|
|
|
|
|
associated with the given parameters. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub create |
99
|
|
|
|
|
|
|
{ |
100
|
0
|
|
|
0
|
1
|
|
my ($self, $name, $params) = @_; |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
croak(ref($self)."->create() not implemented."); |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
return 1; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# }}} |
108
|
|
|
|
|
|
|
# {{{ open() |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item $dir->open($params) |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
TODO |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub open |
117
|
|
|
|
|
|
|
{ |
118
|
0
|
|
|
0
|
1
|
|
my ($self, $dir_name, $params) = @_; |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
croak(ref($self)."->open() not implemented."); |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
return 1; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
# }}} |
126
|
|
|
|
|
|
|
# {{{ close() |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item $dir->close($params) |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
TODO |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub close |
135
|
|
|
|
|
|
|
{ |
136
|
0
|
|
|
0
|
1
|
|
my ($self, $params) = @_; |
137
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
croak(ref($self)."->close() not implemented."); |
139
|
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
return 1; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
# }}} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
# {{{ store_object(): |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub store_object |
148
|
|
|
|
|
|
|
{ |
149
|
0
|
|
|
0
|
0
|
|
my ($self, $obj) = @_; |
150
|
0
|
|
|
|
|
|
my $id; |
151
|
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
croak(ref($self)."->store_object() not implemented."); |
153
|
|
|
|
|
|
|
|
154
|
0
|
|
|
|
|
|
return $id; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
# }}} |
158
|
|
|
|
|
|
|
# {{{ retrieve_object(): |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub retrieve_object |
161
|
|
|
|
|
|
|
{ |
162
|
0
|
|
|
0
|
0
|
|
my ($self, $id) = @_; |
163
|
0
|
|
|
|
|
|
my $obj; |
164
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
croak(ref($self)."->retrieve_object() not implemented."); |
166
|
|
|
|
|
|
|
|
167
|
0
|
|
|
|
|
|
return $obj; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
# }}} |
171
|
|
|
|
|
|
|
# {{{ delete_object |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub delete_object |
174
|
|
|
|
|
|
|
{ |
175
|
0
|
|
|
0
|
0
|
|
my ($self, $id, $obj) = @_; |
176
|
|
|
|
|
|
|
|
177
|
0
|
|
|
|
|
|
croak(ref($self)."->delete_object() not implemented."); |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
|
return 1; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# }}} |
183
|
|
|
|
|
|
|
# {{{ search_objects |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
sub search_objects |
186
|
|
|
|
|
|
|
{ |
187
|
0
|
|
|
0
|
0
|
|
my ($self, $parsed) = @_; |
188
|
0
|
|
|
|
|
|
my @ids; |
189
|
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
|
croak(ref($self)."->search_objects() not implemented."); |
191
|
|
|
|
|
|
|
|
192
|
0
|
|
|
|
|
|
return @ids; |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
# }}} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
# {{{ is_ready(): |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub is_ready |
200
|
|
|
|
|
|
|
{ |
201
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
202
|
|
|
|
|
|
|
|
203
|
0
|
0
|
|
|
|
|
return undef if (!defined $self->{directory}); |
204
|
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
|
return ( $self->{directory}->{created} eq 1 ); |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
# }}} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
# {{{ DESTROY |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub DESTROY |
213
|
0
|
|
|
0
|
|
|
{ |
214
|
|
|
|
|
|
|
## no-op to pacify warnings |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
# }}} |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
# {{{ End POD |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=back |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head1 AUTHOR |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
Maintained by Leslie Michael Orchard > |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head1 COPYRIGHT |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
Copyright (c) 2000, Leslie Michael Orchard. All Rights Reserved. |
230
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or |
231
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=cut |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
# }}} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
1; |
238
|
|
|
|
|
|
|
__END__ |