Subversion Repositories XServices

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
64 brianR 1
/*
2
 *   Copyright 2010 Brian Rosenberger (Brutex Network)
3
 *
4
 *   Licensed under the Apache License, Version 2.0 (the "License");
5
 *   you may not use this file except in compliance with the License.
6
 *   You may obtain a copy of the License at
7
 *
8
 *       http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *   Unless required by applicable law or agreed to in writing, software
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *   See the License for the specific language governing permissions and
14
 *   limitations under the License.
15
 */
16
 
46 brianR 17
package net.brutex.xservices.ws;
18
 
63 brianR 19
import java.util.List;
20
 
46 brianR 21
import javax.jws.WebMethod;
22
import javax.jws.WebParam;
23
import javax.jws.WebService;
64 brianR 24
import javax.xml.bind.annotation.XmlElement;
46 brianR 25
 
64 brianR 26
import org.apache.cxf.annotations.WSDLDocumentation;
27
import org.apache.cxf.annotations.WSDLDocumentationCollection;
28
 
63 brianR 29
import net.brutex.xservices.types.ReplacePattern;
46 brianR 30
import net.brutex.xservices.types.ReturnCode;
83 brianR 31
import net.brutex.xservices.types.ant.ArchiveResource;
32
import net.brutex.xservices.types.ant.AttachmentType;
33
import net.brutex.xservices.types.ant.FileResource;
34
import net.brutex.xservices.types.ant.FileSetResource;
46 brianR 35
import net.brutex.xservices.util.BrutexNamespaces;
64 brianR 36
import net.brutex.xservices.util.XServicesDocumentation;
37
/**
70 brianR 38
 * File related web service operations.
39
 *
64 brianR 40
 * @author Brian Rosenberger
70 brianR 41
 * @since 0.3.0
64 brianR 42
 *
43
 */
46 brianR 44
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
64 brianR 45
@WSDLDocumentationCollection(
46
    {
47
    	@WSDLDocumentation(value = BrutexNamespaces.BRUTEX_COPYRIGHT, placement = WSDLDocumentation.Placement.TOP)
48
    }
49
)
46 brianR 50
public interface FileService {
51
 
70 brianR 52
	final String OPERATION_BASENAME ="basename";
53
	final String OPERATION_DOWNLOADFILE ="downloadFile";
54
	final String OPERATION_UPLOADFILE ="uploadFile";
55
	final String OPERATION_COPY ="copy";
56
	final String OPERATION_COPYFILE ="copyFile";
57
	final String OPERATION_LOADRESOURCE = "loadResource";
58
	final String OPERATION_LOADRESOURCEFROMARCHIVE = "loadResourceFromArchive";
59
	final String OPERATION_ECHOTOFILE = "echoToFile";
60
	final String OPERATION_CHANGEOWNER = "changeOwner";
61
	final String OPERATION_CHANGEMODE = "changeMode";
62
	final String OPERATION_CHANGEGROUP = "changeGroup";
63
	final String OPERATION_REPLACEINFILE = "replaceInFile";
64
	final String OPERATION_REPLACEINFILE2 = "replaceInFile2";
65
	final String OPERATION_REPLACEINFILEREGEX = "replaceInFileRegEx";
65 brianR 66
 
70 brianR 67
	final String PARAM_FILE = "file";
68
	final String PARAM_ENCODING = "encoding";
69
	final String PARAM_OVERRIDE = "override";
70
 
64 brianR 71
	/**
72
	 * @param filename
73
	 * @param suffix
74
	 * @return The base name of the given file excluding the suffix.
75
	 */
76
	@WSDLDocumentation(value = "The base name of the given file excluding the suffix.")
65 brianR 77
	@WebMethod(operationName = OPERATION_BASENAME)
64 brianR 78
	public abstract String basename(
70 brianR 79
			@WebParam(name = PARAM_FILE) @XmlElement(required=true) String filename,
46 brianR 80
			@WebParam(name = "suffix") String suffix);
81
 
64 brianR 82
	/**
83
	 * @param res
84
	 * @return The file itself (MTOM attachment or inline base64) including some file metadata.
65 brianR 85
	 * @throws XServicesFault
64 brianR 86
	 */
87
	@WSDLDocumentation(XServicesDocumentation.SERVICE_OPERATION_DOWNLOADFILE)
65 brianR 88
	@WebMethod(operationName = OPERATION_DOWNLOADFILE)
54 brianR 89
	public abstract AttachmentType downloadFile(
65 brianR 90
			@WebParam(name = FileResource.XML_NAME) FileResource res) throws XServicesFault;
54 brianR 91
 
64 brianR 92
	/**
93
	 * @param file
94
	 * @return The file name of the file that has been uploaded.
65 brianR 95
	 * @throws XServicesFault
64 brianR 96
	 */
97
	@WSDLDocumentation(XServicesDocumentation.SERVICE_OPERATION_UPLOADFILE)
65 brianR 98
	@WebMethod(operationName = OPERATION_UPLOADFILE)
54 brianR 99
	public abstract String uploadFile(
70 brianR 100
			@WebParam(name = PARAM_FILE) AttachmentType file) throws XServicesFault;
54 brianR 101
 
64 brianR 102
	/**
103
	 * @param src
104
	 * @param todir
105
	 * @param plm
106
	 * @param overwrite
107
	 * @param encoding
108
	 * @return
109
	 * @throws XServicesFault
110
	 */
111
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_COPY)
65 brianR 112
	@WebMethod(operationName = OPERATION_COPY)
46 brianR 113
	public abstract ReturnCode copy(
65 brianR 114
			@WebParam(name =  FileSetResource.XML_NAME) @XmlElement(required=true) FileSetResource src,
64 brianR 115
			@WebParam(name = "todir") @XmlElement(required=true) String todir,
46 brianR 116
			@WebParam(name = "preservelastmodified") boolean plm,
70 brianR 117
			@WebParam(name = PARAM_OVERRIDE) boolean overwrite,
118
			@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
64 brianR 119
 
120
	/**
121
	 * @param fromFile
122
	 * @param tofile
123
	 * @param overwrite
124
	 * @return
125
	 * @throws XServicesFault
126
	 */
127
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_COPYFILE)
65 brianR 128
	@WebMethod(operationName = OPERATION_COPYFILE)
64 brianR 129
	public abstract ReturnCode copyFile(
130
			@WebParam(name = "fromFile") @XmlElement(required=true) String fromFile,
131
			@WebParam(name = "toFile") @XmlElement(required=true) String tofile,
70 brianR 132
			@WebParam(name = PARAM_OVERRIDE) boolean overwrite) throws XServicesFault;
46 brianR 133
 
64 brianR 134
	/**
135
	 * @param res
136
	 * @param encoding
137
	 * @return content of the resource
65 brianR 138
	 * @throws XServicesFault
64 brianR 139
	 */
140
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_LOADRESOURCE)
65 brianR 141
	@WebMethod(operationName = OPERATION_LOADRESOURCE)
64 brianR 142
	public abstract String loadRes(
65 brianR 143
			@WebParam(name = FileResource.XML_NAME) FileResource res,
70 brianR 144
			@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
46 brianR 145
 
64 brianR 146
	/**
147
	 * @param res
148
	 * @param encoding
149
	 * @return content of the resource
65 brianR 150
	 * @throws XServicesFault
64 brianR 151
	 */
152
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_LOADRESOURCEFROMARCHIVE)
65 brianR 153
	@WebMethod(operationName = OPERATION_LOADRESOURCEFROMARCHIVE)
64 brianR 154
	public abstract String loadResFromArchive(
46 brianR 155
			@WebParam(name = "archiveresource") ArchiveResource res,
70 brianR 156
			@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
46 brianR 157
 
64 brianR 158
	/**
159
	 * @param message
160
	 * @param file
161
	 * @param encoding
162
	 * @param append
111 brianR 163
	 * @param create
64 brianR 164
	 * @return
65 brianR 165
	 * @throws XServicesFault
64 brianR 166
	 */
167
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_ECHOTOFILE)
65 brianR 168
	@WebMethod(operationName = OPERATION_ECHOTOFILE)
46 brianR 169
	public abstract ReturnCode echo2file(
64 brianR 170
			@WebParam(name = "message") @XmlElement(required=true) String message,
70 brianR 171
			@WebParam(name = PARAM_FILE) @XmlElement(required=true) String file,
172
			@WebParam(name = PARAM_ENCODING) String encoding,
111 brianR 173
			@WebParam(name = "append") boolean append,
174
			@WebParam(name = "create") boolean create) throws XServicesFault;
46 brianR 175
 
65 brianR 176
	/**
70 brianR 177
	 * Changes the owner of a file or all files inside specified directories.
178
	 * Right now it has effect only under Unix/ Linux as it is implemented through
179
	 * the 'chown' command.
180
	 *
181
	 * @param res Collection of files/ directories
182
	 * @param owner Identifier of the new owner
183
	 * @return
65 brianR 184
	 */
185
	@WebMethod(operationName = OPERATION_CHANGEOWNER)
46 brianR 186
	public abstract ReturnCode changeOwner(
65 brianR 187
			@WebParam(name =  FileSetResource.XML_NAME) FileSetResource res,
64 brianR 188
			@WebParam(name = "owner") @XmlElement(required=true) String owner);
46 brianR 189
 
65 brianR 190
	/**
70 brianR 191
	 * Changes the group owner of a file or all files inside specified directories.
192
	 * Right now it has effect only under Unix/ Linux as it is implemented through
193
	 * the 'chgrp' command.
194
	 *
195
	 * @param res Collection of files/ directories
196
	 * @param group Identifier of the new group owner
65 brianR 197
	 * @return
198
	 */
199
	@WebMethod(operationName = OPERATION_CHANGEGROUP)
46 brianR 200
	public abstract ReturnCode changeGroup(
65 brianR 201
			@WebParam(name =  FileSetResource.XML_NAME) FileSetResource res,
64 brianR 202
			@WebParam(name = "group") @XmlElement(required=true) String group);
46 brianR 203
 
65 brianR 204
	/**
205
	 * @param res
206
	 * @param perm
207
	 * @return
208
	 */
209
	@WebMethod(operationName = OPERATION_CHANGEMODE)
46 brianR 210
	public abstract ReturnCode changeMode(
65 brianR 211
			@WebParam(name = FileSetResource.XML_NAME) FileSetResource res,
64 brianR 212
			@WebParam(name = "permissions") @XmlElement(required=true) String perm);
63 brianR 213
 
65 brianR 214
	/**
215
	 * @param res
216
	 * @param search
217
	 * @param replace
218
	 * @return
219
	 * @throws XServicesFault
220
	 */
221
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE)
222
	@WebMethod(operationName = OPERATION_REPLACEINFILE)
63 brianR 223
	public abstract ReturnCode replaceInFile(
65 brianR 224
			@WebParam(name = FileResource.XML_NAME) @XmlElement(required=true) FileResource res,
64 brianR 225
			@WebParam(name = "search") @XmlElement(required=true) String search,
65 brianR 226
			@WebParam(name = "replace") @XmlElement(required=true) String replace) throws XServicesFault;
63 brianR 227
 
65 brianR 228
	/**
229
	 * @param res
230
	 * @param patternList
231
	 * @return
232
	 * @throws XServicesFault
233
	 */
234
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE2)
235
	@WebMethod(operationName = OPERATION_REPLACEINFILE2)
63 brianR 236
	public abstract ReturnCode replaceInFile2(
65 brianR 237
			@WebParam(name = FileResource.XML_NAME) FileResource res,
238
			@WebParam(name = "patternList") List<ReplacePattern> patternList) throws XServicesFault;
63 brianR 239
 
65 brianR 240
	/**
241
	 * @param res
242
	 * @param search
243
	 * @param replace
244
	 * @param flags
245
	 * @return
246
	 * @throws XServicesFault
247
	 */
248
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILEREGEX)
249
	@WebMethod(operationName = OPERATION_REPLACEINFILEREGEX)
63 brianR 250
	public abstract ReturnCode replaceInFileRegEx(
65 brianR 251
			@WebParam(name = FileResource.XML_NAME) FileResource res,
63 brianR 252
			@WebParam(name = "search") String search,
253
			@WebParam(name = "replace") String replace,
65 brianR 254
			@WebParam(name = "flags") String flags) throws XServicesFault;
46 brianR 255
}