X-Git-Url: http://wagnertech.de/git?p=kivitendo-erp.git;a=blobdiff_plain;f=SL%2FFile%2FBackend.pm;fp=SL%2FFile%2FBackend.pm;h=2f1da83d371a54b4791508c5247359d8234d981b;hp=0000000000000000000000000000000000000000;hb=53593baa211863fbf66540cf1bcc36c8fb37257f;hpb=deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44 diff --git a/SL/File/Backend.pm b/SL/File/Backend.pm new file mode 100644 index 000000000..2f1da83d3 --- /dev/null +++ b/SL/File/Backend.pm @@ -0,0 +1,201 @@ +package SL::File::Backend; + +use strict; + +use parent qw(Rose::Object); + +sub store { die 'store needs to be implemented' } + +sub delete { die 'delete needs to be implemented' } + +sub rename { die 'rename needs to be implemented' } + +sub get_content { die 'get_content needs to be implemented' } + +sub get_filepath { die 'get_filepath needs to be implemented' } + +sub get_mtime { die 'get_mtime needs to be implemented' } + +sub get_version_count { die 'get_version_count needs to be implemented' } + +sub enabled { 0; } + +sub sync_from_backend { } + +1; + +__END__ + +=pod + +=encoding utf8 + +=head1 NAME + +SL::File::Backend - Base class for file storage backend + +=head1 SYNOPSIS + +See the synopsis of L and L + +=head1 OVERVIEW + +The most methods must be overridden by the specific storage backend + +See also the overview of L and L. + + +=head1 METHODS + +=over 4 + +=item C + +The file data is stored in the backend. + +Available C: + +=over 4 + +=item C + +The object SL::DB::File as param. + +=item C + +The data of the file to store + +=item C + +If the data is still in a file, the contents of this file is copied. + +=back + +If both parameter C and C exists, +the backend is responsible in which way the contents is fetched. + +If the file exists the backend is responsible to decide to save a new version of the file or override the +latest existing file. + +=item C + +The file data is deleted in the backend. + +Available C: + +=over 4 + +=item C + +The object SL::DB::File as param. + +=item C + +If this parameter is set only the latest version of the file are deleted. + +=item C + +If this parameter is set all versions of the file are deleted except the latest version. + +If none of the two parameters C or C is set +all version of the file are deleted. + +=back + +=item C + +The Filename of the file is changed. If the backend is not dependent from the filename +nothing must happens. The rename must work on all versions of the file. + +Available C: + +=over 4 + +=item C + +The object SL::DB::File as param. + +=back + +=item C + +The count of the available versions of a file will returned. +The versions are numbered from 1 up to the returned value + +Available C: + +=over 4 + +=item C + +=back + +=item C + +Available C: + +=over 4 + +=item C + +The object SL::DB::File as param. + +=item C + +The version number of the file for which the modification timestamp is wanted. +If no version set or version is 0 , the mtime of the latest version is returned. + +=back + +=item C + +For downloading or printing the real data need to retrieve. +A reference of the data must be returned. + +Available C: + +=over 4 + +=item C + +The object SL::DB::File as param. + +=back + +=item C + +If the backend has files as storage, the file path can returned. +If a file is not available in the backend a temporary file must be created with the contents. + +Available C: + +=over 4 + +=item C + +The object SL::DB::File as param. + +=back + +=item C + +returns 1 if the backend is enabled and has all config to work. +In other cases it must return 0 + +=item C + +For Backends which may be changed outside of kivitendo a synchronization of the database is done. +Normally the backend is responsible to actualise the data if it needed. +This interface can be used if a long work must be done and runs in a extra task. + +=back + +=head1 SEE ALSO + +L, L + +=head1 AUTHOR + +Martin Helmling Emartin.helmling@opendynamic.deE + +=cut