Subversion Repositories XServices

Rev

Rev 70 | Go to most recent revision | Details | Compare with Previous | 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
163
	 * @return
65 brianR 164
	 * @throws XServicesFault
64 brianR 165
	 */
166
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_ECHOTOFILE)
65 brianR 167
	@WebMethod(operationName = OPERATION_ECHOTOFILE)
46 brianR 168
	public abstract ReturnCode echo2file(
64 brianR 169
			@WebParam(name = "message") @XmlElement(required=true) String message,
70 brianR 170
			@WebParam(name = PARAM_FILE) @XmlElement(required=true) String file,
171
			@WebParam(name = PARAM_ENCODING) String encoding,
65 brianR 172
			@WebParam(name = "append") boolean append) throws XServicesFault;
46 brianR 173
 
65 brianR 174
	/**
70 brianR 175
	 * Changes the owner of a file or all files inside specified directories.
176
	 * Right now it has effect only under Unix/ Linux as it is implemented through
177
	 * the 'chown' command.
178
	 *
179
	 * @param res Collection of files/ directories
180
	 * @param owner Identifier of the new owner
181
	 * @return
65 brianR 182
	 */
183
	@WebMethod(operationName = OPERATION_CHANGEOWNER)
46 brianR 184
	public abstract ReturnCode changeOwner(
65 brianR 185
			@WebParam(name =  FileSetResource.XML_NAME) FileSetResource res,
64 brianR 186
			@WebParam(name = "owner") @XmlElement(required=true) String owner);
46 brianR 187
 
65 brianR 188
	/**
70 brianR 189
	 * Changes the group owner of a file or all files inside specified directories.
190
	 * Right now it has effect only under Unix/ Linux as it is implemented through
191
	 * the 'chgrp' command.
192
	 *
193
	 * @param res Collection of files/ directories
194
	 * @param group Identifier of the new group owner
65 brianR 195
	 * @return
196
	 */
197
	@WebMethod(operationName = OPERATION_CHANGEGROUP)
46 brianR 198
	public abstract ReturnCode changeGroup(
65 brianR 199
			@WebParam(name =  FileSetResource.XML_NAME) FileSetResource res,
64 brianR 200
			@WebParam(name = "group") @XmlElement(required=true) String group);
46 brianR 201
 
65 brianR 202
	/**
203
	 * @param res
204
	 * @param perm
205
	 * @return
206
	 */
207
	@WebMethod(operationName = OPERATION_CHANGEMODE)
46 brianR 208
	public abstract ReturnCode changeMode(
65 brianR 209
			@WebParam(name = FileSetResource.XML_NAME) FileSetResource res,
64 brianR 210
			@WebParam(name = "permissions") @XmlElement(required=true) String perm);
63 brianR 211
 
65 brianR 212
	/**
213
	 * @param res
214
	 * @param search
215
	 * @param replace
216
	 * @return
217
	 * @throws XServicesFault
218
	 */
219
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE)
220
	@WebMethod(operationName = OPERATION_REPLACEINFILE)
63 brianR 221
	public abstract ReturnCode replaceInFile(
65 brianR 222
			@WebParam(name = FileResource.XML_NAME) @XmlElement(required=true) FileResource res,
64 brianR 223
			@WebParam(name = "search") @XmlElement(required=true) String search,
65 brianR 224
			@WebParam(name = "replace") @XmlElement(required=true) String replace) throws XServicesFault;
63 brianR 225
 
65 brianR 226
	/**
227
	 * @param res
228
	 * @param patternList
229
	 * @return
230
	 * @throws XServicesFault
231
	 */
232
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE2)
233
	@WebMethod(operationName = OPERATION_REPLACEINFILE2)
63 brianR 234
	public abstract ReturnCode replaceInFile2(
65 brianR 235
			@WebParam(name = FileResource.XML_NAME) FileResource res,
236
			@WebParam(name = "patternList") List<ReplacePattern> patternList) throws XServicesFault;
63 brianR 237
 
65 brianR 238
	/**
239
	 * @param res
240
	 * @param search
241
	 * @param replace
242
	 * @param flags
243
	 * @return
244
	 * @throws XServicesFault
245
	 */
246
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILEREGEX)
247
	@WebMethod(operationName = OPERATION_REPLACEINFILEREGEX)
63 brianR 248
	public abstract ReturnCode replaceInFileRegEx(
65 brianR 249
			@WebParam(name = FileResource.XML_NAME) FileResource res,
63 brianR 250
			@WebParam(name = "search") String search,
251
			@WebParam(name = "replace") String replace,
65 brianR 252
			@WebParam(name = "flags") String flags) throws XServicesFault;
46 brianR 253
}