Subversion Repositories XServices

Rev

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

Rev 83 Rev 92
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";
54
	final String OPERATION_UPLOADFILE ="uploadFile";
55
	final String OPERATION_UPLOADFILE ="uploadFile";
55
	final String OPERATION_COPY ="copy";
56
	final String OPERATION_COPY ="copy";
56
	final String OPERATION_COPYFILE ="copyFile";
57
	final String OPERATION_COPYFILE ="copyFile";
57
	final String OPERATION_LOADRESOURCE = "loadResource";
58
	final String OPERATION_LOADRESOURCE = "loadResource";
58
	final String OPERATION_LOADRESOURCEFROMARCHIVE = "loadResourceFromArchive";
59
	final String OPERATION_LOADRESOURCEFROMARCHIVE = "loadResourceFromArchive";
59
	final String OPERATION_ECHOTOFILE = "echoToFile";
60
	final String OPERATION_ECHOTOFILE = "echoToFile";
60
	final String OPERATION_CHANGEOWNER = "changeOwner";
61
	final String OPERATION_CHANGEOWNER = "changeOwner";
61
	final String OPERATION_CHANGEMODE = "changeMode";
62
	final String OPERATION_CHANGEMODE = "changeMode";
62
	final String OPERATION_CHANGEGROUP = "changeGroup";
63
	final String OPERATION_CHANGEGROUP = "changeGroup";
63
	final String OPERATION_REPLACEINFILE = "replaceInFile";
64
	final String OPERATION_REPLACEINFILE = "replaceInFile";
64
	final String OPERATION_REPLACEINFILE2 = "replaceInFile2";
65
	final String OPERATION_REPLACEINFILE2 = "replaceInFile2";
65
	final String OPERATION_REPLACEINFILEREGEX = "replaceInFileRegEx";
66
	final String OPERATION_REPLACEINFILEREGEX = "replaceInFileRegEx";
66
	
67
	
67
	final String PARAM_FILE = "file";
68
	final String PARAM_FILE = "file";
68
	final String PARAM_ENCODING = "encoding";
69
	final String PARAM_ENCODING = "encoding";
69
	final String PARAM_OVERRIDE = "override";
70
	final String PARAM_OVERRIDE = "override";
70
	
71
	
71
	/**
72
	/**
72
	 * @param filename
73
	 * @param filename
73
	 * @param suffix
74
	 * @param suffix
74
	 * @return The base name of the given file excluding the suffix. 
75
	 * @return The base name of the given file excluding the suffix. 
75
	 */
76
	 */
76
	@WSDLDocumentation(value = "The base name of the given file excluding the suffix.")
77
	@WSDLDocumentation(value = "The base name of the given file excluding the suffix.")
77
	@WebMethod(operationName = OPERATION_BASENAME)
78
	@WebMethod(operationName = OPERATION_BASENAME)
78
	public abstract String basename(
79
	public abstract String basename(
79
			@WebParam(name = PARAM_FILE) @XmlElement(required=true) String filename,
80
			@WebParam(name = PARAM_FILE) @XmlElement(required=true) String filename,
80
			@WebParam(name = "suffix") String suffix);
81
			@WebParam(name = "suffix") String suffix);
81
 
82
 
82
	/**
83
	/**
83
	 * @param res
84
	 * @param res
84
	 * @return The file itself (MTOM attachment or inline base64) including some file metadata.
85
	 * @return The file itself (MTOM attachment or inline base64) including some file metadata.
85
	 * @throws XServicesFault 
86
	 * @throws XServicesFault 
86
	 */
87
	 */
87
	@WSDLDocumentation(XServicesDocumentation.SERVICE_OPERATION_DOWNLOADFILE)
88
	@WSDLDocumentation(XServicesDocumentation.SERVICE_OPERATION_DOWNLOADFILE)
88
	@WebMethod(operationName = OPERATION_DOWNLOADFILE)
89
	@WebMethod(operationName = OPERATION_DOWNLOADFILE)
89
	public abstract AttachmentType downloadFile(
90
	public abstract AttachmentType downloadFile(
90
			@WebParam(name = FileResource.XML_NAME) FileResource res) throws XServicesFault;
91
			@WebParam(name = FileResource.XML_NAME) FileResource res) throws XServicesFault;
-
 
92
	
-
 
93
	/**
-
 
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;
91
	
102
	
92
	/**
103
	/**
93
	 * @param file
104
	 * @param file
94
	 * @return The file name of the file that has been uploaded.
105
	 * @return The file name of the file that has been uploaded.
95
	 * @throws XServicesFault 
106
	 * @throws XServicesFault 
96
	 */
107
	 */
97
	@WSDLDocumentation(XServicesDocumentation.SERVICE_OPERATION_UPLOADFILE)
108
	@WSDLDocumentation(XServicesDocumentation.SERVICE_OPERATION_UPLOADFILE)
98
	@WebMethod(operationName = OPERATION_UPLOADFILE)
109
	@WebMethod(operationName = OPERATION_UPLOADFILE)
99
	public abstract String uploadFile(
110
	public abstract String uploadFile(
100
			@WebParam(name = PARAM_FILE) AttachmentType file) throws XServicesFault;
111
			@WebParam(name = PARAM_FILE) AttachmentType file) throws XServicesFault;
101
			
112
			
102
	/**
113
	/**
103
	 * @param src
114
	 * @param src
104
	 * @param todir
115
	 * @param todir
105
	 * @param plm
116
	 * @param plm
106
	 * @param overwrite
117
	 * @param overwrite
107
	 * @param encoding
118
	 * @param encoding
108
	 * @return 
119
	 * @return 
109
	 * @throws XServicesFault
120
	 * @throws XServicesFault
110
	 */
121
	 */
111
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_COPY)
122
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_COPY)
112
	@WebMethod(operationName = OPERATION_COPY)
123
	@WebMethod(operationName = OPERATION_COPY)
113
	public abstract ReturnCode copy(
124
	public abstract ReturnCode copy(
114
			@WebParam(name =  FileSetResource.XML_NAME) @XmlElement(required=true) FileSetResource src,
125
			@WebParam(name =  FileSetResource.XML_NAME) @XmlElement(required=true) FileSetResource src,
115
			@WebParam(name = "todir") @XmlElement(required=true) String todir,
126
			@WebParam(name = "todir") @XmlElement(required=true) String todir,
116
			@WebParam(name = "preservelastmodified") boolean plm,
127
			@WebParam(name = "preservelastmodified") boolean plm,
117
			@WebParam(name = PARAM_OVERRIDE) boolean overwrite,
128
			@WebParam(name = PARAM_OVERRIDE) boolean overwrite,
118
			@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
129
			@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
119
	
130
	
120
	/**
131
	/**
121
	 * @param fromFile
132
	 * @param fromFile
122
	 * @param tofile
133
	 * @param tofile
123
	 * @param overwrite
134
	 * @param overwrite
124
	 * @return
135
	 * @return
125
	 * @throws XServicesFault
136
	 * @throws XServicesFault
126
	 */
137
	 */
127
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_COPYFILE)
138
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_COPYFILE)
128
	@WebMethod(operationName = OPERATION_COPYFILE)
139
	@WebMethod(operationName = OPERATION_COPYFILE)
129
	public abstract ReturnCode copyFile(
140
	public abstract ReturnCode copyFile(
130
			@WebParam(name = "fromFile") @XmlElement(required=true) String fromFile,
141
			@WebParam(name = "fromFile") @XmlElement(required=true) String fromFile,
131
			@WebParam(name = "toFile") @XmlElement(required=true) String tofile,
142
			@WebParam(name = "toFile") @XmlElement(required=true) String tofile,
132
			@WebParam(name = PARAM_OVERRIDE) boolean overwrite) throws XServicesFault;
143
			@WebParam(name = PARAM_OVERRIDE) boolean overwrite) throws XServicesFault;
133
 
144
 
134
	/**
145
	/**
135
	 * @param res
146
	 * @param res
136
	 * @param encoding
147
	 * @param encoding
137
	 * @return content of the resource
148
	 * @return content of the resource
138
	 * @throws XServicesFault 
149
	 * @throws XServicesFault 
139
	 */
150
	 */
140
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_LOADRESOURCE)
151
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_LOADRESOURCE)
141
	@WebMethod(operationName = OPERATION_LOADRESOURCE)
152
	@WebMethod(operationName = OPERATION_LOADRESOURCE)
142
	public abstract String loadRes(
153
	public abstract String loadRes(
143
			@WebParam(name = FileResource.XML_NAME) FileResource res,
154
			@WebParam(name = FileResource.XML_NAME) FileResource res,
144
			@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
155
			@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
145
 
156
 
146
	/**
157
	/**
147
	 * @param res
158
	 * @param res
148
	 * @param encoding
159
	 * @param encoding
149
	 * @return content of the resource
160
	 * @return content of the resource
150
	 * @throws XServicesFault 
161
	 * @throws XServicesFault 
151
	 */
162
	 */
152
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_LOADRESOURCEFROMARCHIVE)
163
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_LOADRESOURCEFROMARCHIVE)
153
	@WebMethod(operationName = OPERATION_LOADRESOURCEFROMARCHIVE)
164
	@WebMethod(operationName = OPERATION_LOADRESOURCEFROMARCHIVE)
154
	public abstract String loadResFromArchive(
165
	public abstract String loadResFromArchive(
155
			@WebParam(name = "archiveresource") ArchiveResource res,
166
			@WebParam(name = "archiveresource") ArchiveResource res,
156
			@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
167
			@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
157
 
168
 
158
	/**
169
	/**
159
	 * @param message
170
	 * @param message
160
	 * @param file
171
	 * @param file
161
	 * @param encoding
172
	 * @param encoding
162
	 * @param append
173
	 * @param append
163
	 * @return
174
	 * @return
164
	 * @throws XServicesFault 
175
	 * @throws XServicesFault 
165
	 */
176
	 */
166
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_ECHOTOFILE)
177
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_ECHOTOFILE)
167
	@WebMethod(operationName = OPERATION_ECHOTOFILE)
178
	@WebMethod(operationName = OPERATION_ECHOTOFILE)
168
	public abstract ReturnCode echo2file(
179
	public abstract ReturnCode echo2file(
169
			@WebParam(name = "message") @XmlElement(required=true) String message,
180
			@WebParam(name = "message") @XmlElement(required=true) String message,
170
			@WebParam(name = PARAM_FILE) @XmlElement(required=true) String file,
181
			@WebParam(name = PARAM_FILE) @XmlElement(required=true) String file,
171
			@WebParam(name = PARAM_ENCODING) String encoding,
182
			@WebParam(name = PARAM_ENCODING) String encoding,
172
			@WebParam(name = "append") boolean append) throws XServicesFault;
183
			@WebParam(name = "append") boolean append) throws XServicesFault;
173
 
184
 
174
	/**
185
	/**
175
	 * Changes the owner of a file or all files inside specified directories. 
186
	 * 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
187
	 * Right now it has effect only under Unix/ Linux as it is implemented through
177
	 * the 'chown' command.
188
	 * the 'chown' command.
178
	 * 
189
	 * 
179
	 * @param res Collection of files/ directories
190
	 * @param res Collection of files/ directories
180
	 * @param owner Identifier of the new owner
191
	 * @param owner Identifier of the new owner
181
	 * @return 
192
	 * @return 
182
	 */
193
	 */
183
	@WebMethod(operationName = OPERATION_CHANGEOWNER)
194
	@WebMethod(operationName = OPERATION_CHANGEOWNER)
184
	public abstract ReturnCode changeOwner(
195
	public abstract ReturnCode changeOwner(
185
			@WebParam(name =  FileSetResource.XML_NAME) FileSetResource res,
196
			@WebParam(name =  FileSetResource.XML_NAME) FileSetResource res,
186
			@WebParam(name = "owner") @XmlElement(required=true) String owner);
197
			@WebParam(name = "owner") @XmlElement(required=true) String owner);
187
 
198
 
188
	/**
199
	/**
189
	 * Changes the group owner of a file or all files inside specified directories. 
200
	 * 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
201
	 * Right now it has effect only under Unix/ Linux as it is implemented through
191
	 * the 'chgrp' command.
202
	 * the 'chgrp' command.
192
	 * 
203
	 * 
193
	 * @param res Collection of files/ directories
204
	 * @param res Collection of files/ directories
194
	 * @param group Identifier of the new group owner
205
	 * @param group Identifier of the new group owner
195
	 * @return
206
	 * @return
196
	 */
207
	 */
197
	@WebMethod(operationName = OPERATION_CHANGEGROUP)
208
	@WebMethod(operationName = OPERATION_CHANGEGROUP)
198
	public abstract ReturnCode changeGroup(
209
	public abstract ReturnCode changeGroup(
199
			@WebParam(name =  FileSetResource.XML_NAME) FileSetResource res,
210
			@WebParam(name =  FileSetResource.XML_NAME) FileSetResource res,
200
			@WebParam(name = "group") @XmlElement(required=true) String group);
211
			@WebParam(name = "group") @XmlElement(required=true) String group);
201
 
212
 
202
	/**
213
	/**
203
	 * @param res
214
	 * @param res
204
	 * @param perm
215
	 * @param perm
205
	 * @return
216
	 * @return
206
	 */
217
	 */
207
	@WebMethod(operationName = OPERATION_CHANGEMODE)
218
	@WebMethod(operationName = OPERATION_CHANGEMODE)
208
	public abstract ReturnCode changeMode(
219
	public abstract ReturnCode changeMode(
209
			@WebParam(name = FileSetResource.XML_NAME) FileSetResource res,
220
			@WebParam(name = FileSetResource.XML_NAME) FileSetResource res,
210
			@WebParam(name = "permissions") @XmlElement(required=true) String perm);
221
			@WebParam(name = "permissions") @XmlElement(required=true) String perm);
211
	
222
	
212
	/**
223
	/**
213
	 * @param res
224
	 * @param res
214
	 * @param search
225
	 * @param search
215
	 * @param replace
226
	 * @param replace
216
	 * @return
227
	 * @return
217
	 * @throws XServicesFault
228
	 * @throws XServicesFault
218
	 */
229
	 */
219
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE)
230
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE)
220
	@WebMethod(operationName = OPERATION_REPLACEINFILE)
231
	@WebMethod(operationName = OPERATION_REPLACEINFILE)
221
	public abstract ReturnCode replaceInFile(
232
	public abstract ReturnCode replaceInFile(
222
			@WebParam(name = FileResource.XML_NAME) @XmlElement(required=true) FileResource res,
233
			@WebParam(name = FileResource.XML_NAME) @XmlElement(required=true) FileResource res,
223
			@WebParam(name = "search") @XmlElement(required=true) String search,
234
			@WebParam(name = "search") @XmlElement(required=true) String search,
224
			@WebParam(name = "replace") @XmlElement(required=true) String replace) throws XServicesFault;
235
			@WebParam(name = "replace") @XmlElement(required=true) String replace) throws XServicesFault;
225
	
236
	
226
	/**
237
	/**
227
	 * @param res
238
	 * @param res
228
	 * @param patternList
239
	 * @param patternList
229
	 * @return
240
	 * @return
230
	 * @throws XServicesFault
241
	 * @throws XServicesFault
231
	 */
242
	 */
232
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE2)
243
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE2)
233
	@WebMethod(operationName = OPERATION_REPLACEINFILE2)
244
	@WebMethod(operationName = OPERATION_REPLACEINFILE2)
234
	public abstract ReturnCode replaceInFile2(
245
	public abstract ReturnCode replaceInFile2(
235
			@WebParam(name = FileResource.XML_NAME) FileResource res,
246
			@WebParam(name = FileResource.XML_NAME) FileResource res,
236
			@WebParam(name = "patternList") List<ReplacePattern> patternList) throws XServicesFault;
247
			@WebParam(name = "patternList") List<ReplacePattern> patternList) throws XServicesFault;
237
	
248
	
238
	/**
249
	/**
239
	 * @param res
250
	 * @param res
240
	 * @param search
251
	 * @param search
241
	 * @param replace
252
	 * @param replace
242
	 * @param flags
253
	 * @param flags
243
	 * @return
254
	 * @return
244
	 * @throws XServicesFault
255
	 * @throws XServicesFault
245
	 */
256
	 */
246
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILEREGEX)
257
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILEREGEX)
247
	@WebMethod(operationName = OPERATION_REPLACEINFILEREGEX)
258
	@WebMethod(operationName = OPERATION_REPLACEINFILEREGEX)
248
	public abstract ReturnCode replaceInFileRegEx(
259
	public abstract ReturnCode replaceInFileRegEx(
249
			@WebParam(name = FileResource.XML_NAME) FileResource res,
260
			@WebParam(name = FileResource.XML_NAME) FileResource res,
250
			@WebParam(name = "search") String search,
261
			@WebParam(name = "search") String search,
251
			@WebParam(name = "replace") String replace,
262
			@WebParam(name = "replace") String replace,
252
			@WebParam(name = "flags") String flags) throws XServicesFault;
263
			@WebParam(name = "flags") String flags) throws XServicesFault;
253
}
264
}
254
 
265
 
255
Generated by GNU Enscript 1.6.5.90.
266
Generated by GNU Enscript 1.6.5.90.
256
 
267
 
257
 
268