Subversion Repositories XServices

Rev

Rev 92 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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