1 package SL::File::Backend;
5 use parent qw(Rose::Object);
7 sub store { die 'store needs to be implemented' }
9 sub delete { die 'delete needs to be implemented' }
11 sub rename { die 'rename needs to be implemented' }
13 sub get_content { die 'get_content needs to be implemented' }
15 sub get_filepath { die 'get_filepath needs to be implemented' }
17 sub get_mtime { die 'get_mtime needs to be implemented' }
19 sub get_version_count { die 'get_version_count needs to be implemented' }
23 sub sync_from_backend { }
35 SL::File::Backend - Base class for file storage backend
39 See the synopsis of L<SL::File> and L<SL::File::Object>
43 The most methods must be overridden by the specific storage backend
45 See also the overview of L<SL::File> and L<SL::File::Object>.
54 The file data is stored in the backend.
62 The object SL::DB::File as param.
64 =item C<file_contents>
66 The data of the file to store
70 If the data is still in a file, the contents of this file is copied.
74 If both parameter C<file_contents> and C<file_path> exists,
75 the backend is responsible in which way the contents is fetched.
77 If the file exists the backend is responsible to decide to save a new version of the file or override the
80 =item C<delete PARAMS>
82 The file data is deleted in the backend.
90 The object SL::DB::File as param.
94 If this parameter is set only the latest version of the file are deleted.
96 =item C<all_but_notlast>
98 If this parameter is set all versions of the file are deleted except the latest version.
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.
105 =item C<rename PARAMS>
107 The Filename of the file is changed. If the backend is not dependent from the filename
108 nothing must happens. The rename must work on all versions of the file.
116 The object SL::DB::File as param.
120 =item C<get_version_count PARAMS>
122 The count of the available versions of a file will returned.
123 The versions are numbered from 1 up to the returned value
133 =item C<get_mtime PARAMS>
141 The object SL::DB::File as param.
145 The version number of the file for which the modification timestamp is wanted.
146 If no version set or version is 0 , the mtime of the latest version is returned.
150 =item C<get_content PARAMS>
152 For downloading or printing the real data need to retrieve.
153 A reference of the data must be returned.
161 The object SL::DB::File as param.
165 =item C<get_file_path PARAMS>
167 If the backend has files as storage, the file path can returned.
168 If a file is not available in the backend a temporary file must be created with the contents.
176 The object SL::DB::File as param.
182 returns 1 if the backend is enabled and has all config to work.
183 In other cases it must return 0
185 =item C<sync_from_backend>
187 For Backends which may be changed outside of kivitendo a synchronization of the database is done.
188 Normally the backend is responsible to actualise the data if it needed.
189 This interface can be used if a long work must be done and runs in a extra task.
195 L<SL::File>, L<SL::File::Object>
199 Martin Helmling E<lt>martin.helmling@opendynamic.deE<gt>