Subversion Repositories XServices

Rev

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

Rev 65 Rev 70
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
 
-
 
29
import com.sun.xml.internal.ws.api.model.wsdl.WSDLDescriptorKind;
-
 
30
 
28
 
31
import net.brutex.xservices.types.ArchiveResource;
29
import net.brutex.xservices.types.ArchiveResource;
32
import net.brutex.xservices.types.AttachmentType;
30
import net.brutex.xservices.types.AttachmentType;
33
import net.brutex.xservices.types.FileResource;
31
import net.brutex.xservices.types.FileResource;
34
import net.brutex.xservices.types.FileSetResource;
32
import net.brutex.xservices.types.FileSetResource;
35
import net.brutex.xservices.types.ReplacePattern;
33
import net.brutex.xservices.types.ReplacePattern;
36
import net.brutex.xservices.types.ReturnCode;
34
import net.brutex.xservices.types.ReturnCode;
37
import net.brutex.xservices.util.BrutexNamespaces;
35
import net.brutex.xservices.util.BrutexNamespaces;
38
import net.brutex.xservices.util.XServicesDocumentation;
36
import net.brutex.xservices.util.XServicesDocumentation;
39
/**
37
/**
-
 
38
 * File related web service operations.
-
 
39
 * 
40
 * @author Brian Rosenberger
40
 * @author Brian Rosenberger
-
 
41
 * @since 0.3.0
41
 *
42
 *
42
 */
43
 */
43
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
44
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
44
@WSDLDocumentationCollection(
45
@WSDLDocumentationCollection(
45
    {
46
    {
46
    	@WSDLDocumentation(value = BrutexNamespaces.BRUTEX_COPYRIGHT, placement = WSDLDocumentation.Placement.TOP)
47
    	@WSDLDocumentation(value = BrutexNamespaces.BRUTEX_COPYRIGHT, placement = WSDLDocumentation.Placement.TOP)
47
    }
48
    }
48
)
49
)
49
public interface FileService {
50
public interface FileService {
50
 
51
 
51
	public static final String OPERATION_BASENAME ="basename";
52
	final String OPERATION_BASENAME ="basename";
52
	public static final String OPERATION_DOWNLOADFILE ="downloadFile";
53
	final String OPERATION_DOWNLOADFILE ="downloadFile";
53
	public static final String OPERATION_UPLOADFILE ="uploadFile";
54
	final String OPERATION_UPLOADFILE ="uploadFile";
54
	public static final String OPERATION_COPY ="copy";
55
	final String OPERATION_COPY ="copy";
55
	public static final String OPERATION_COPYFILE ="copyFile";
56
	final String OPERATION_COPYFILE ="copyFile";
56
	public static final String OPERATION_LOADRESOURCE = "loadResource";
57
	final String OPERATION_LOADRESOURCE = "loadResource";
57
	public static final String OPERATION_LOADRESOURCEFROMARCHIVE = "loadResourceFromArchive";
58
	final String OPERATION_LOADRESOURCEFROMARCHIVE = "loadResourceFromArchive";
58
	public static final String OPERATION_ECHOTOFILE = "echoToFile";
59
	final String OPERATION_ECHOTOFILE = "echoToFile";
59
	public static final String OPERATION_CHANGEOWNER = "changeOwner";
60
	final String OPERATION_CHANGEOWNER = "changeOwner";
60
	public static final String OPERATION_CHANGEMODE = "changeMode";
61
	final String OPERATION_CHANGEMODE = "changeMode";
61
	public static final String OPERATION_CHANGEGROUP = "changeGroup";
62
	final String OPERATION_CHANGEGROUP = "changeGroup";
62
	public static final String OPERATION_REPLACEINFILE = "replaceInFile";
63
	final String OPERATION_REPLACEINFILE = "replaceInFile";
63
	public static final String OPERATION_REPLACEINFILE2 = "replaceInFile2";
64
	final String OPERATION_REPLACEINFILE2 = "replaceInFile2";
-
 
65
	final String OPERATION_REPLACEINFILEREGEX = "replaceInFileRegEx";
-
 
66
	
-
 
67
	final String PARAM_FILE = "file";
-
 
68
	final String PARAM_ENCODING = "encoding";
64
	public static final String OPERATION_REPLACEINFILEREGEX = "replaceInFileRegEx";
69
	final String PARAM_OVERRIDE = "override";
65
	
70
	
66
	/**
71
	/**
67
	 * @param filename
72
	 * @param filename
68
	 * @param suffix
73
	 * @param suffix
69
	 * @return The base name of the given file excluding the suffix. 
74
	 * @return The base name of the given file excluding the suffix. 
70
	 */
75
	 */
71
	@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.")
72
	@WebMethod(operationName = OPERATION_BASENAME)
77
	@WebMethod(operationName = OPERATION_BASENAME)
73
	public abstract String basename(
78
	public abstract String basename(
74
			@WebParam(name = "file") @XmlElement(required=true) String filename,
79
			@WebParam(name = PARAM_FILE) @XmlElement(required=true) String filename,
75
			@WebParam(name = "suffix") String suffix);
80
			@WebParam(name = "suffix") String suffix);
76
 
81
 
77
	/**
82
	/**
78
	 * @param res
83
	 * @param res
79
	 * @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.
80
	 * @throws XServicesFault 
85
	 * @throws XServicesFault 
81
	 */
86
	 */
82
	@WSDLDocumentation(XServicesDocumentation.SERVICE_OPERATION_DOWNLOADFILE)
87
	@WSDLDocumentation(XServicesDocumentation.SERVICE_OPERATION_DOWNLOADFILE)
83
	@WebMethod(operationName = OPERATION_DOWNLOADFILE)
88
	@WebMethod(operationName = OPERATION_DOWNLOADFILE)
84
	public abstract AttachmentType downloadFile(
89
	public abstract AttachmentType downloadFile(
85
			@WebParam(name = FileResource.XML_NAME) FileResource res) throws XServicesFault;
90
			@WebParam(name = FileResource.XML_NAME) FileResource res) throws XServicesFault;
86
	
91
	
87
	/**
92
	/**
88
	 * @param file
93
	 * @param file
89
	 * @return The file name of the file that has been uploaded.
94
	 * @return The file name of the file that has been uploaded.
90
	 * @throws XServicesFault 
95
	 * @throws XServicesFault 
91
	 */
96
	 */
92
	@WSDLDocumentation(XServicesDocumentation.SERVICE_OPERATION_UPLOADFILE)
97
	@WSDLDocumentation(XServicesDocumentation.SERVICE_OPERATION_UPLOADFILE)
93
	@WebMethod(operationName = OPERATION_UPLOADFILE)
98
	@WebMethod(operationName = OPERATION_UPLOADFILE)
94
	public abstract String uploadFile(
99
	public abstract String uploadFile(
95
			@WebParam(name = "file") AttachmentType file) throws XServicesFault;
100
			@WebParam(name = PARAM_FILE) AttachmentType file) throws XServicesFault;
96
			
101
			
97
	/**
102
	/**
98
	 * @param src
103
	 * @param src
99
	 * @param todir
104
	 * @param todir
100
	 * @param plm
105
	 * @param plm
101
	 * @param overwrite
106
	 * @param overwrite
102
	 * @param encoding
107
	 * @param encoding
103
	 * @return 
108
	 * @return 
104
	 * @throws XServicesFault
109
	 * @throws XServicesFault
105
	 */
110
	 */
106
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_COPY)
111
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_COPY)
107
	@WebMethod(operationName = OPERATION_COPY)
112
	@WebMethod(operationName = OPERATION_COPY)
108
	public abstract ReturnCode copy(
113
	public abstract ReturnCode copy(
109
			@WebParam(name =  FileSetResource.XML_NAME) @XmlElement(required=true) FileSetResource src,
114
			@WebParam(name =  FileSetResource.XML_NAME) @XmlElement(required=true) FileSetResource src,
110
			@WebParam(name = "todir") @XmlElement(required=true) String todir,
115
			@WebParam(name = "todir") @XmlElement(required=true) String todir,
111
			@WebParam(name = "preservelastmodified") boolean plm,
116
			@WebParam(name = "preservelastmodified") boolean plm,
112
			@WebParam(name = "overwrite") boolean overwrite,
117
			@WebParam(name = PARAM_OVERRIDE) boolean overwrite,
113
			@WebParam(name = "encoding") String encoding) throws XServicesFault;
118
			@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
114
	
119
	
115
	/**
120
	/**
116
	 * @param fromFile
121
	 * @param fromFile
117
	 * @param tofile
122
	 * @param tofile
118
	 * @param overwrite
123
	 * @param overwrite
119
	 * @return
124
	 * @return
120
	 * @throws XServicesFault
125
	 * @throws XServicesFault
121
	 */
126
	 */
122
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_COPYFILE)
127
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_COPYFILE)
123
	@WebMethod(operationName = OPERATION_COPYFILE)
128
	@WebMethod(operationName = OPERATION_COPYFILE)
124
	public abstract ReturnCode copyFile(
129
	public abstract ReturnCode copyFile(
125
			@WebParam(name = "fromFile") @XmlElement(required=true) String fromFile,
130
			@WebParam(name = "fromFile") @XmlElement(required=true) String fromFile,
126
			@WebParam(name = "toFile") @XmlElement(required=true) String tofile,
131
			@WebParam(name = "toFile") @XmlElement(required=true) String tofile,
127
			@WebParam(name = "overwrite") boolean overwrite) throws XServicesFault;
132
			@WebParam(name = PARAM_OVERRIDE) boolean overwrite) throws XServicesFault;
128
 
133
 
129
	/**
134
	/**
130
	 * @param res
135
	 * @param res
131
	 * @param encoding
136
	 * @param encoding
132
	 * @return content of the resource
137
	 * @return content of the resource
133
	 * @throws XServicesFault 
138
	 * @throws XServicesFault 
134
	 */
139
	 */
135
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_LOADRESOURCE)
140
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_LOADRESOURCE)
136
	@WebMethod(operationName = OPERATION_LOADRESOURCE)
141
	@WebMethod(operationName = OPERATION_LOADRESOURCE)
137
	public abstract String loadRes(
142
	public abstract String loadRes(
138
			@WebParam(name = FileResource.XML_NAME) FileResource res,
143
			@WebParam(name = FileResource.XML_NAME) FileResource res,
139
			@WebParam(name = "encoding") String encoding) throws XServicesFault;
144
			@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
140
 
145
 
141
	/**
146
	/**
142
	 * @param res
147
	 * @param res
143
	 * @param encoding
148
	 * @param encoding
144
	 * @return content of the resource
149
	 * @return content of the resource
145
	 * @throws XServicesFault 
150
	 * @throws XServicesFault 
146
	 */
151
	 */
147
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_LOADRESOURCEFROMARCHIVE)
152
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_LOADRESOURCEFROMARCHIVE)
148
	@WebMethod(operationName = OPERATION_LOADRESOURCEFROMARCHIVE)
153
	@WebMethod(operationName = OPERATION_LOADRESOURCEFROMARCHIVE)
149
	public abstract String loadResFromArchive(
154
	public abstract String loadResFromArchive(
150
			@WebParam(name = "archiveresource") ArchiveResource res,
155
			@WebParam(name = "archiveresource") ArchiveResource res,
151
			@WebParam(name = "encoding") String encoding) throws XServicesFault;
156
			@WebParam(name = PARAM_ENCODING) String encoding) throws XServicesFault;
152
 
157
 
153
	/**
158
	/**
154
	 * @param message
159
	 * @param message
155
	 * @param file
160
	 * @param file
156
	 * @param encoding
161
	 * @param encoding
157
	 * @param append
162
	 * @param append
158
	 * @return
163
	 * @return
159
	 * @throws XServicesFault 
164
	 * @throws XServicesFault 
160
	 */
165
	 */
161
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_ECHOTOFILE)
166
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_ECHOTOFILE)
162
	@WebMethod(operationName = OPERATION_ECHOTOFILE)
167
	@WebMethod(operationName = OPERATION_ECHOTOFILE)
163
	public abstract ReturnCode echo2file(
168
	public abstract ReturnCode echo2file(
164
			@WebParam(name = "message") @XmlElement(required=true) String message,
169
			@WebParam(name = "message") @XmlElement(required=true) String message,
165
			@WebParam(name = "file") @XmlElement(required=true) String file,
170
			@WebParam(name = PARAM_FILE) @XmlElement(required=true) String file,
166
			@WebParam(name = "encoding") String encoding,
171
			@WebParam(name = PARAM_ENCODING) String encoding,
167
			@WebParam(name = "append") boolean append) throws XServicesFault;
172
			@WebParam(name = "append") boolean append) throws XServicesFault;
168
 
173
 
169
	/**
174
	/**
-
 
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
170
	 * @param res
177
	 * the 'chown' command.
-
 
178
	 * 
-
 
179
	 * @param res Collection of files/ directories
171
	 * @param owner
180
	 * @param owner Identifier of the new owner
172
	 * @return
181
	 * @return 
173
	 */
182
	 */
174
	@WebMethod(operationName = OPERATION_CHANGEOWNER)
183
	@WebMethod(operationName = OPERATION_CHANGEOWNER)
175
	public abstract ReturnCode changeOwner(
184
	public abstract ReturnCode changeOwner(
176
			@WebParam(name =  FileSetResource.XML_NAME) FileSetResource res,
185
			@WebParam(name =  FileSetResource.XML_NAME) FileSetResource res,
177
			@WebParam(name = "owner") @XmlElement(required=true) String owner);
186
			@WebParam(name = "owner") @XmlElement(required=true) String owner);
178
 
187
 
179
	/**
188
	/**
-
 
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
180
	 * @param res
191
	 * the 'chgrp' command.
-
 
192
	 * 
-
 
193
	 * @param res Collection of files/ directories
181
	 * @param group
194
	 * @param group Identifier of the new group owner
182
	 * @return
195
	 * @return
183
	 */
196
	 */
184
	@WebMethod(operationName = OPERATION_CHANGEGROUP)
197
	@WebMethod(operationName = OPERATION_CHANGEGROUP)
185
	public abstract ReturnCode changeGroup(
198
	public abstract ReturnCode changeGroup(
186
			@WebParam(name =  FileSetResource.XML_NAME) FileSetResource res,
199
			@WebParam(name =  FileSetResource.XML_NAME) FileSetResource res,
187
			@WebParam(name = "group") @XmlElement(required=true) String group);
200
			@WebParam(name = "group") @XmlElement(required=true) String group);
188
 
201
 
189
	/**
202
	/**
190
	 * @param res
203
	 * @param res
191
	 * @param perm
204
	 * @param perm
192
	 * @return
205
	 * @return
193
	 */
206
	 */
194
	@WebMethod(operationName = OPERATION_CHANGEMODE)
207
	@WebMethod(operationName = OPERATION_CHANGEMODE)
195
	public abstract ReturnCode changeMode(
208
	public abstract ReturnCode changeMode(
196
			@WebParam(name = FileSetResource.XML_NAME) FileSetResource res,
209
			@WebParam(name = FileSetResource.XML_NAME) FileSetResource res,
197
			@WebParam(name = "permissions") @XmlElement(required=true) String perm);
210
			@WebParam(name = "permissions") @XmlElement(required=true) String perm);
198
	
211
	
199
	/**
212
	/**
200
	 * @param res
213
	 * @param res
201
	 * @param search
214
	 * @param search
202
	 * @param replace
215
	 * @param replace
203
	 * @return
216
	 * @return
204
	 * @throws XServicesFault
217
	 * @throws XServicesFault
205
	 */
218
	 */
206
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE)
219
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE)
207
	@WebMethod(operationName = OPERATION_REPLACEINFILE)
220
	@WebMethod(operationName = OPERATION_REPLACEINFILE)
208
	public abstract ReturnCode replaceInFile(
221
	public abstract ReturnCode replaceInFile(
209
			@WebParam(name = FileResource.XML_NAME) @XmlElement(required=true) FileResource res,
222
			@WebParam(name = FileResource.XML_NAME) @XmlElement(required=true) FileResource res,
210
			@WebParam(name = "search") @XmlElement(required=true) String search,
223
			@WebParam(name = "search") @XmlElement(required=true) String search,
211
			@WebParam(name = "replace") @XmlElement(required=true) String replace) throws XServicesFault;
224
			@WebParam(name = "replace") @XmlElement(required=true) String replace) throws XServicesFault;
212
	
225
	
213
	/**
226
	/**
214
	 * @param res
227
	 * @param res
215
	 * @param patternList
228
	 * @param patternList
216
	 * @return
229
	 * @return
217
	 * @throws XServicesFault
230
	 * @throws XServicesFault
218
	 */
231
	 */
219
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE2)
232
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILE2)
220
	@WebMethod(operationName = OPERATION_REPLACEINFILE2)
233
	@WebMethod(operationName = OPERATION_REPLACEINFILE2)
221
	public abstract ReturnCode replaceInFile2(
234
	public abstract ReturnCode replaceInFile2(
222
			@WebParam(name = FileResource.XML_NAME) FileResource res,
235
			@WebParam(name = FileResource.XML_NAME) FileResource res,
223
			@WebParam(name = "patternList") List<ReplacePattern> patternList) throws XServicesFault;
236
			@WebParam(name = "patternList") List<ReplacePattern> patternList) throws XServicesFault;
224
	
237
	
225
	/**
238
	/**
226
	 * @param res
239
	 * @param res
227
	 * @param search
240
	 * @param search
228
	 * @param replace
241
	 * @param replace
229
	 * @param flags
242
	 * @param flags
230
	 * @return
243
	 * @return
231
	 * @throws XServicesFault
244
	 * @throws XServicesFault
232
	 */
245
	 */
233
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILEREGEX)
246
	@WSDLDocumentation(value = XServicesDocumentation.SERVICE_OPERATION_REPLACEINFILEREGEX)
234
	@WebMethod(operationName = OPERATION_REPLACEINFILEREGEX)
247
	@WebMethod(operationName = OPERATION_REPLACEINFILEREGEX)
235
	public abstract ReturnCode replaceInFileRegEx(
248
	public abstract ReturnCode replaceInFileRegEx(
236
			@WebParam(name = FileResource.XML_NAME) FileResource res,
249
			@WebParam(name = FileResource.XML_NAME) FileResource res,
237
			@WebParam(name = "search") String search,
250
			@WebParam(name = "search") String search,
238
			@WebParam(name = "replace") String replace,
251
			@WebParam(name = "replace") String replace,
239
			@WebParam(name = "flags") String flags) throws XServicesFault;
252
			@WebParam(name = "flags") String flags) throws XServicesFault;
240
}
253
}
241
 
254
 
242
Generated by GNU Enscript 1.6.5.90.
255
Generated by GNU Enscript 1.6.5.90.
243
 
256
 
244
 
257