/
BackEnd.pm
122 lines (83 loc) · 2.51 KB
/
BackEnd.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#
# Copyright (C) 2009 Crawford Currie, http://c-dot.co.uk
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details, published at
# http://www.gnu.org/copyleft/gpl.html
=begin TML
Abstract base class of back-end modules for !PublishPlugin.
This class defines the interface that must be implemented by back end
archive generators.
=cut
package Foswiki::Plugins::PublishPlugin::BackEnd;
=begin TML
---++ ClassMethod new($params, $path, $logger)
Construct a new back end.
* =$params= ref to hash of param vals
* =$path= - the target path of the publishing process
* =$logger= - ref to an object that supports logWarn, logInfo and logError
methods (see Publisher.pm)
=cut
sub new {
my ( $class, $params, $path, $logger ) = @_;
$path .= '/' unless $path =~ m#/$#;
my $this = bless(
{
path => $path,
params => $params,
logger => $logger
},
$class
);
return $this;
}
=begin TML
---++ ClassMethod param_schema -> \%schema
Get schema of query parameters, in the same format as Publisher.pm
=cut
sub param_schema {
return { relativeurl => { default => '/' }, };
}
=begin TML
---++ ObjectMethod addDirectory($dir)
Add a directory to the archive. If it already exists, should not complain.
Errors should be logged to the logger.
=cut
sub addDirectory {
my ( $this, $dir ) = @_;
}
=begin TML
---++ ObjectMethod addString($data, $to)
Add a block of $data to the archive by creating file =$to= and
writing the data to it.
Errors should be logged to the logger.
=cut
sub addString {
my ( $this, $data, $to ) = @_;
}
=begin TML
---++ ObjectMethod addFile($from, $to)
Add =$from= to the archive with the path =$to=. =$from= and =$to= are paths.
Errors should be logged to the logger.
=cut
sub addFile {
my ( $this, $from, $to ) = @_;
}
=begin TML
---++ ObjectMethod close() -> $landed
Close the archive, and return the path to the completed archive. This is a
path relative to the publish dir.
Errors should be logged to the logger.
=cut
sub close {
my $this = shift;
return $this->{path};
}
1;