]> wagnertech.de Git - mfinanz.git/blob - SL/File/Backend.pm
Merge branch 'master' of http://wagnertech.de/git/mfinanz
[mfinanz.git] / SL / File / Backend.pm
1 package SL::File::Backend;
2
3 use strict;
4
5 use parent qw(Rose::Object);
6
7 sub store { die 'store needs to be implemented' }
8
9 sub delete { die 'delete needs to be implemented' }
10
11 sub rename { die 'rename needs to be implemented' }
12
13 sub get_content { die 'get_content needs to be implemented' }
14
15 sub get_filepath { die 'get_filepath needs to be implemented' }
16
17 sub get_mtime { die 'get_mtime needs to be implemented' }
18
19 sub get_version_count { die 'get_version_count needs to be implemented' }
20
21 sub enabled { 0; }
22
23 sub sync_from_backend { }
24
25 1;
26
27 __END__
28
29 =pod
30
31 =encoding utf8
32
33 =head1 NAME
34
35 SL::File::Backend  - Base class for file storage backend
36
37 =head1 SYNOPSIS
38
39 See the synopsis of L<SL::File> and L<SL::File::Object>
40
41 =head1 OVERVIEW
42
43 The most methods must be overridden by the specific storage backend
44
45 See also the overview of L<SL::File> and L<SL::File::Object>.
46
47
48 =head1 METHODS
49
50 =over 4
51
52 =item C<store PARAMS>
53
54 The file data is stored in the backend.
55
56 Available C<PARAMS>:
57
58 =over 4
59
60 =item C<dbfile>
61
62 The object SL::DB::File as param.
63
64 =item C<file_contents>
65
66 The data of the file to store
67
68 =item C<file_path>
69
70 If the data is still in a file, the contents of this file is copied.
71
72 =back
73
74 If both parameter C<file_contents> and C<file_path> exists,
75 the backend is responsible in which way the contents is fetched.
76
77 If the file exists the backend is responsible to decide to save a new version of the file or override the
78 latest existing file.
79
80 =item C<delete PARAMS>
81
82 The file data is deleted in the backend.
83
84 Available C<PARAMS>:
85
86 =over 4
87
88 =item C<dbfile>
89
90 The object SL::DB::File as param.
91
92 =item C<last>
93
94 If this parameter is set only the latest version of the file are deleted.
95
96 =item C<all_but_notlast>
97
98 If this parameter is set all versions of the file are deleted except the latest version.
99
100 If none of the two parameters C<all_versions> or C<all__but_notlast> is set
101 all version of the file are deleted.
102
103 =item C<file_version>
104
105 If this parameter is set only this file version will be deleted. The object has
106 to be of type C<SL::DB::FileVersion>.
107
108 =back
109
110 =item C<rename PARAMS>
111
112 The Filename of the file is changed. If the backend is not dependent from the filename
113 nothing must happens. The rename must work on all versions of the file.
114
115 Available C<PARAMS>:
116
117 =over 4
118
119 =item C<dbfile>
120
121 The object SL::DB::File as param.
122
123 =back
124
125 =item C<get_version_count PARAMS>
126
127 The count of the available versions of a file will returned.
128 The versions are numbered from 1 up to the returned value
129
130 Available C<PARAMS>:
131
132 =over 4
133
134 =item C<dbfile>
135
136 =back
137
138 =item C<get_mtime PARAMS>
139
140 Available C<PARAMS>:
141
142 =over 4
143
144 =item C<dbfile>
145
146 The object SL::DB::File as param.
147
148 =item C<version>
149
150 The version number of the file for which the modification timestamp is wanted.
151 If no version set or version is 0 , the mtime of the latest version is returned.
152
153 =back
154
155 =item C<get_content PARAMS>
156
157 For downloading or printing the real data need to retrieve.
158 A reference of the data must be returned.
159
160 Available C<PARAMS>:
161
162 =over 4
163
164 =item C<dbfile>
165
166 The object SL::DB::File as param.
167
168 =back
169
170 =item C<get_file_path PARAMS>
171
172 If the backend has files as storage, the file path can returned.
173 If a file is not available in the backend a temporary file must be created with the contents.
174
175 Available C<PARAMS>:
176
177 =over 4
178
179 =item C<dbfile>
180
181 The object SL::DB::File as param.
182
183 =back
184
185 =item C<enabled>
186
187 returns 1 if the backend is enabled and has all config to work.
188 In other cases it must return 0
189
190 =item C<sync_from_backend>
191
192 For Backends which may be changed outside of kivitendo a synchronization of the database is done.
193 Normally the backend is responsible to actualise the data if it needed.
194 This interface can be used if a long work must be done and runs in a extra task.
195
196 =back
197
198 =head1 SEE ALSO
199
200 L<SL::File>, L<SL::File::Object>
201
202 =head1 AUTHOR
203
204 Martin Helmling E<lt>martin.helmling@opendynamic.deE<gt>
205
206 =cut