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