Subversion Repositories XServices

Rev

Rev 64 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 64 Rev 65
Line 13... Line 13...
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
package net.brutex.xservices.ws.impl;
16
package net.brutex.xservices.ws.impl;
Line 17... Line -...
17
 
-
 
18
import java.io.BufferedInputStream;
17
 
19
import java.io.File;
-
 
20
import java.io.FileInputStream;
18
import java.io.File;
21
import java.io.FileNotFoundException;
19
import java.io.FileNotFoundException;
22
import java.io.FileOutputStream;
20
import java.io.FileOutputStream;
23
import java.io.IOException;
21
import java.io.IOException;
24
import java.io.InputStream;
-
 
25
import java.io.UnsupportedEncodingException;
-
 
26
import java.util.Iterator;
22
import java.io.InputStream;
Line 27... Line 23...
27
import java.util.List;
23
import java.util.List;
28
 
24
 
29
import javax.activation.DataHandler;
25
import javax.activation.DataHandler;
30
import javax.jws.WebMethod;
26
import javax.jws.WebMethod;
Line 31... Line -...
31
import javax.jws.WebParam;
-
 
32
import javax.jws.WebService;
27
import javax.jws.WebParam;
33
 
28
import javax.jws.WebService;
34
import net.brutex.xservices.types.AntProperty;
29
 
35
import net.brutex.xservices.types.ArchiveResource;
30
import net.brutex.xservices.types.ArchiveResource;
36
import net.brutex.xservices.types.AttachmentType;
31
import net.brutex.xservices.types.AttachmentType;
37
import net.brutex.xservices.types.FileResource;
-
 
38
import net.brutex.xservices.types.FileSetResource;
32
import net.brutex.xservices.types.FileResource;
39
import net.brutex.xservices.types.ReplacePattern;
33
import net.brutex.xservices.types.FileSetResource;
40
import net.brutex.xservices.types.ResourceInterface;
34
import net.brutex.xservices.types.ReplacePattern;
41
import net.brutex.xservices.types.ReturnCode;
35
import net.brutex.xservices.types.ReturnCode;
42
import net.brutex.xservices.util.BrutexNamespaces;
36
import net.brutex.xservices.util.BrutexNamespaces;
Line 43... Line -...
43
import net.brutex.xservices.util.RunTask;
-
 
44
import net.brutex.xservices.ws.FileService;
-
 
45
import net.brutex.xservices.ws.XServicesFault;
37
import net.brutex.xservices.util.RunTask;
46
 
38
import net.brutex.xservices.ws.FileService;
47
import org.apache.commons.codec.binary.Base64;
39
import net.brutex.xservices.ws.XServicesFault;
48
import org.apache.commons.codec.binary.Base64InputStream;
40
 
49
import org.apache.cxf.aegis.type.mtom.StreamDataSource;
41
import org.apache.cxf.aegis.type.mtom.StreamDataSource;
Line 56... Line 48...
56
import org.apache.tools.ant.taskdefs.Replace;
48
import org.apache.tools.ant.taskdefs.Replace;
57
import org.apache.tools.ant.taskdefs.optional.ReplaceRegExp;
49
import org.apache.tools.ant.taskdefs.optional.ReplaceRegExp;
58
import org.apache.tools.ant.taskdefs.optional.unix.Chgrp;
50
import org.apache.tools.ant.taskdefs.optional.unix.Chgrp;
59
import org.apache.tools.ant.taskdefs.optional.unix.Chown;
51
import org.apache.tools.ant.taskdefs.optional.unix.Chown;
60
import org.apache.tools.ant.types.FileSet;
52
import org.apache.tools.ant.types.FileSet;
61
import org.apache.tools.ant.types.Resource;
-
 
62
import org.apache.tools.ant.types.ResourceCollection;
-
 
Line 63... Line 53...
63
 
53
 
64
/**
54
/**
65
 * 
55
 * 
66
 * @author Brian Rosenberger, bru@brutex.de
56
 * @author Brian Rosenberger, bru@brutex.de
Line 73... Line 63...
73
	 * 
63
	 * 
74
	 * @see net.brutex.xservices.ws.impl.FileService#basename(java.lang.String,
64
	 * @see net.brutex.xservices.ws.impl.FileService#basename(java.lang.String,
75
	 * java.lang.String)
65
	 * java.lang.String)
76
	 */
66
	 */
77
	@Override
67
	@Override
78
	@WebMethod(operationName = "basename")
-
 
79
	public String basename(@WebParam(name = "file") String filename,
68
	public String basename(String filename, String suffix) {
80
			@WebParam(name = "suffix") String suffix) {
-
 
81
		final String BASENAME_VALUE = "basename.value";
69
		final String BASENAME_VALUE = "basename.value";
82
		Basename basename = new Basename();
70
		Basename basename = new Basename();
83
		RunTask runner = new RunTask(basename);
71
		RunTask runner = new RunTask(basename);
84
		basename.setFile(new File(filename));
72
		basename.setFile(new File(filename));
85
		if (suffix != null && !suffix.equals("")) {
73
		if (suffix != null && !suffix.equals("")) {
86
			basename.setSuffix(suffix);
74
			basename.setSuffix(suffix);
87
		}
75
		}
88
		basename.setProperty("BASENAME_VALUE");
76
		basename.setProperty(BASENAME_VALUE);
89
		ReturnCode r = runner.postTask();
77
		ReturnCode r = runner.postTask();
90
		return r.getProperty("BASENAME_VALUE");
78
		return r.getProperty(BASENAME_VALUE);
91
	}
79
	}
Line 92... Line -...
92
 
-
 
93
	@WebMethod(operationName = "replaceInFile")
80
 
94
	public ReturnCode replaceInFile(
-
 
95
			@WebParam(name = "file") FileResource res,
-
 
96
			@WebParam(name = "search") String search,
81
	public ReturnCode replaceInFile(FileResource res, String search,
97
			@WebParam(name = "replace") String replace) {
82
			String replace) throws XServicesFault {
98
		ReturnCode r = null;
83
		ReturnCode r = null;
99
		Replace rep = new Replace();
84
		Replace rep = new Replace();
100
		rep.setTaskName("Replace");
85
		rep.setTaskName("Replace");
101
		RunTask runner = new RunTask(rep);
86
		RunTask runner = new RunTask(rep);
102
		rep.addConfigured(res.getAntResource(rep.getProject()));
87
		rep.addConfigured(res.getAntResource(rep.getProject()));
103
		rep.setToken(search);
88
		rep.setToken(search);
-
 
89
		rep.setValue(replace);
104
		rep.setValue(replace);
90
		try {
-
 
91
			r = runner.postTask();
-
 
92
		} catch (BuildException e) {
-
 
93
			throw new XServicesFault(e);
105
		r = runner.postTask();
94
		}
106
		return r;
95
		return r;
Line 107... Line -...
107
	}
-
 
108
	
96
	}
109
	@WebMethod(operationName = "replaceInFile2")
-
 
110
	public ReturnCode replaceInFile2(
97
 
111
			@WebParam(name = "file") FileResource res,
98
	public ReturnCode replaceInFile2(FileResource res,
112
			@WebParam(name = "patternList") List<ReplacePattern> patternList) {
99
			List<ReplacePattern> patternList) throws XServicesFault {
113
		ReturnCode r = null;
100
		ReturnCode r = null;
114
		for (ReplacePattern pat : patternList) {
101
		for (ReplacePattern pat : patternList) {
115
			Replace rep = new Replace();
102
			Replace rep = new Replace();
116
			rep.setTaskName("Replace");
103
			rep.setTaskName("Replace");
117
			RunTask runner = new RunTask(rep);
104
			RunTask runner = new RunTask(rep);
118
			rep.addConfigured(res.getAntResource(rep.getProject()));
105
			rep.addConfigured(res.getAntResource(rep.getProject()));
-
 
106
			rep.setToken(pat.search);
119
			rep.setToken(pat.search);
107
			rep.setValue(pat.replace);
-
 
108
			try {
-
 
109
				r = runner.postTask();
-
 
110
			} catch (BuildException e) {
120
			rep.setValue(pat.replace);
111
				throw new XServicesFault(e);
121
			r = runner.postTask();
112
			}
122
		}
113
		}
Line 123... Line -...
123
		return r;
-
 
124
	}
114
		return r;
125
	
-
 
126
	@WebMethod(operationName = "replaceInFileRegEx")
-
 
127
	public ReturnCode replaceInFileRegEx(
-
 
128
			@WebParam(name = "file") FileResource res,
115
	}
129
			@WebParam(name = "search") String search,
116
 
130
			@WebParam(name = "replace") String replace,
117
	public ReturnCode replaceInFileRegEx(FileResource res, String search,
131
			@WebParam(name = "flags") String flags) {		
118
			String replace, String flags) throws XServicesFault {
132
		ReplaceRegExp rep = new ReplaceRegExp();
119
		ReplaceRegExp rep = new ReplaceRegExp();
133
		rep.setTaskName("ReplaceRegExp");
120
		rep.setTaskName("ReplaceRegExp");
134
		RunTask runner = new RunTask(rep);
121
		RunTask runner = new RunTask(rep);
135
		File infile = new File(res.uri);
122
		File infile = new File(res.uri);
136
		rep.setFile(infile);
123
		rep.setFile(infile);
-
 
124
		rep.setMatch(search);
137
		rep.setMatch(search);
125
		rep.setReplace(replace);
138
		rep.setReplace(replace);
126
		rep.setFlags(flags);
-
 
127
		try {
-
 
128
			ReturnCode r = runner.postTask();
-
 
129
			return r;
139
		rep.setFlags(flags);
130
		} catch (BuildException e) {
140
		ReturnCode r = runner.postTask();		
-
 
Line 141... Line 131...
141
		return r;
131
			throw new XServicesFault(e);
142
	}
132
		}
143
	
133
	}
144
	
134
 
145
	/*
135
	/*
146
	 * (non-Javadoc)
136
	 * (non-Javadoc)
147
	 * 
137
	 * 
148
	 * @see
138
	 * @see
149
	 * net.brutex.xservices.ws.impl.FileService#base64Encode(net.brutex.xservices
-
 
150
	 * .types.FileSetResource)
139
	 * net.brutex.xservices.ws.impl.FileService#base64Encode(net.brutex.xservices
151
	 */
140
	 * .types.FileSetResource)
152
	@Override
141
	 */
153
	@WebMethod(operationName = "downloadFile")
142
	@Override
154
	public AttachmentType downloadFile(@WebParam(name = "file") FileResource res) {
-
 
155
		InputStream is = null;
143
	public AttachmentType downloadFile(FileResource res) throws XServicesFault {
156
		try {
144
		InputStream is = null;
157
			is = res.getAntResource(null).getInputStream();
-
 
158
		} catch (IOException e) {
145
		try {
159
			// TODO Auto-generated catch block
-
 
160
			e.printStackTrace();
146
			is = res.getAntResource(null).getInputStream();
161
		}
147
			StreamDataSource ssource = new StreamDataSource(
162
		DataHandler h = new DataHandler(new StreamDataSource(
148
					"application/binary", is);
163
				"application/binary", is));
149
			DataHandler h = new DataHandler(ssource);
-
 
150
			AttachmentType t = new AttachmentType();
-
 
151
			t.setContent(h);
-
 
152
			t.setFilename(res.getAntResource(null).getName());
164
		AttachmentType t = new AttachmentType();
153
			return t;
Line 165... Line 154...
165
		t.setContent(h);
154
		} catch (IOException e) {
166
		t.setFilename(res.getAntResource(null).getName());
155
			throw new XServicesFault(e);
167
		return t;
156
		}
168
	}
157
	}
169
 
158
 
170
	/*
159
	/*
171
	 * (non-Javadoc)
160
	 * (non-Javadoc)
172
	 * 
161
	 * 
173
	 * @see
-
 
174
	 * net.brutex.xservices.ws.impl.FileService#base64Decode(net.brutex.xservices
162
	 * @see
175
	 * .types.AttachmentType)
163
	 * net.brutex.xservices.ws.impl.FileService#base64Decode(net.brutex.xservices
176
	 */
164
	 * .types.AttachmentType)
177
	@Override
165
	 */
178
	@WebMethod(operationName = "uploadFile")
166
	@Override
179
	public String uploadFile(@WebParam(name = "file") AttachmentType file) {
167
	public String uploadFile(AttachmentType file) throws XServicesFault {
180
		DataHandler h =  file.getContent();
-
 
181
		File f = new File(file.getFilename());
-
 
182
		FileOutputStream fout;
-
 
183
		try {
-
 
184
			fout = new FileOutputStream(f);
-
 
185
			/*
-
 
186
			 * InputStream in = h.getInputStream();
-
 
187
			int b;
168
		DataHandler h = file.getContent();
188
			while( (b=in.read())!= -1 ) {
169
		File f = new File(file.getFilename());
189
				fout.write(b);
170
		FileOutputStream fout;
190
			}
-
 
191
			*/
171
		try {
192
			h.writeTo(fout);
172
			fout = new FileOutputStream(f);
193
			fout.flush();
173
			h.writeTo(fout);
194
			fout.close();
174
			fout.flush();
195
			//in.close();
175
			fout.close();
196
		} catch (FileNotFoundException e) {
176
		} catch (FileNotFoundException e) {
197
			throw new BuildException(e);
177
			throw new XServicesFault(e);
Line 198... Line 178...
198
		} catch (IOException e) {
178
		} catch (IOException e) {
Line 207... Line 187...
207
	 * @see
187
	 * @see
208
	 * net.brutex.xservices.ws.impl.FileService#copy(net.brutex.xservices.types
188
	 * net.brutex.xservices.ws.impl.FileService#copy(net.brutex.xservices.types
209
	 * .FileSetResource, java.lang.String, boolean, boolean, java.lang.String)
189
	 * .FileSetResource, java.lang.String, boolean, boolean, java.lang.String)
210
	 */
190
	 */
211
	@Override
191
	@Override
-
 
192
	public ReturnCode copy(FileSetResource src, String todir, boolean plm,
-
 
193
			boolean overwrite, String encoding) throws XServicesFault {
-
 
194
		Copy copy = new Copy();
212
	@WebMethod(operationName = "copy")
195
		copy.setTaskName("Copy");
-
 
196
		RunTask runner = new RunTask(copy);
213
	public ReturnCode copy(@WebParam(name = "fileset") FileSetResource src,
197
		FileSet set = src.getAntResource(copy.getProject());
-
 
198
		copy.add(set);
214
			@WebParam(name = "todir") String todir,
199
		File dst = new File(todir);
-
 
200
		if (dst.isDirectory()) {
-
 
201
			copy.setTodir(dst);
-
 
202
		}
-
 
203
		if (dst.isFile()) {
-
 
204
			copy.setTofile(dst);
-
 
205
		}
-
 
206
		copy.setOverwrite(overwrite);
215
			@WebParam(name = "preservelastmodified") boolean plm,
207
		copy.setPreserveLastModified(plm);
216
			@WebParam(name = "overwrite") boolean overwrite,
208
		if (encoding != null && !encoding.equals("")) {
217
			@WebParam(name = "encoding") String encoding) throws XServicesFault {
209
			copy.setOutputEncoding(encoding);
-
 
210
		} else {
218
		return copy(src, new File(todir), plm, overwrite, encoding);
211
			copy.setOutputEncoding(System.getProperty("file.encoding"));
-
 
212
		}
-
 
213
		return runner.postTask();
219
	}
214
	}
Line 220... Line 215...
220
	
215
 
221
	@Override
216
	@Override
222
	public ReturnCode copyFile(String fromFile, 
-
 
223
								String tofile,
217
	public ReturnCode copyFile(String fromFile, String tofile, boolean overwrite)
224
								boolean overwrite) throws XServicesFault {
218
			throws XServicesFault {
225
		Copy copy = new Copy();
219
		Copy copy = new Copy();
226
		copy.setTaskName("Copy");
220
		copy.setTaskName("Copy");
227
		RunTask runner = new RunTask(copy);
221
		RunTask runner = new RunTask(copy);
-
 
222
		File f = new File(fromFile);
228
		File f = new File(fromFile);
223
		if (!f.isFile())
229
		if( ! f.isFile() ) throw new XServicesFault("File '"+fromFile+"' not found.");
224
			throw new XServicesFault("File '" + fromFile + "' not found.");
230
		copy.setFile( new File( fromFile ));
225
		copy.setFile(new File(fromFile));
231
		copy.setTofile(new File(tofile));
226
		copy.setTofile(new File(tofile));
232
		copy.setOverwrite(overwrite);
227
		copy.setOverwrite(overwrite);
233
		return runner.postTask();
228
		return runner.postTask();
Line 239... Line 234...
239
	 * @see
234
	 * @see
240
	 * net.brutex.xservices.ws.impl.FileService#loadRes(net.brutex.xservices
235
	 * net.brutex.xservices.ws.impl.FileService#loadRes(net.brutex.xservices
241
	 * .types.FileResource, java.lang.String)
236
	 * .types.FileResource, java.lang.String)
242
	 */
237
	 */
243
	@Override
238
	@Override
244
	@WebMethod(operationName = "loadResource")
-
 
245
	public String loadRes(@WebParam(name = "resource") FileResource res,
239
	public String loadRes(FileResource res, String encoding)
246
			@WebParam(name = "encoding") String encoding) {
240
			throws XServicesFault {
247
		if (encoding == null || encoding.equals("")) {
241
		if (encoding == null || encoding.equals("")) {
248
			encoding = System.getProperty("file.encoding");
242
			encoding = System.getProperty("file.encoding");
249
		}
243
		}
250
		LoadResource lr = new LoadResource();
244
		LoadResource lr = new LoadResource();
251
		lr.setTaskName("LoadResource");
245
		lr.setTaskName("LoadResource");
Line 264... Line 258...
264
	 * @see
258
	 * @see
265
	 * net.brutex.xservices.ws.impl.FileService#loadResFromArchive(net.brutex
259
	 * net.brutex.xservices.ws.impl.FileService#loadResFromArchive(net.brutex
266
	 * .xservices.types.ArchiveResource, java.lang.String)
260
	 * .xservices.types.ArchiveResource, java.lang.String)
267
	 */
261
	 */
268
	@Override
262
	@Override
269
	@WebMethod(operationName = "loadResourceFromArchive")
-
 
270
	public String loadResFromArchive(
263
	public String loadResFromArchive(ArchiveResource res, String encoding) {
271
			@WebParam(name = "archiveresource") ArchiveResource res,
-
 
272
			@WebParam(name = "encoding") String encoding) {
-
 
273
		if (encoding == null || encoding.equals("")) {
264
		if (encoding == null || encoding.equals("")) {
274
			encoding = System.getProperty("file.encoding");
265
			encoding = System.getProperty("file.encoding");
275
		}
266
		}
276
		LoadResource lr = new LoadResource();
267
		LoadResource lr = new LoadResource();
277
		lr.setTaskName("LoadResource");
268
		lr.setTaskName("LoadResource");
Line 290... Line 281...
290
	 * 
281
	 * 
291
	 * @see net.brutex.xservices.ws.impl.FileService#echo2file(java.lang.String,
282
	 * @see net.brutex.xservices.ws.impl.FileService#echo2file(java.lang.String,
292
	 * java.lang.String, java.lang.String, boolean)
283
	 * java.lang.String, java.lang.String, boolean)
293
	 */
284
	 */
294
	@Override
285
	@Override
-
 
286
	public ReturnCode echo2file(String message, String file, String encoding,
-
 
287
			boolean append) throws XServicesFault {
-
 
288
 
-
 
289
		Echo echo = new Echo();
295
	@WebMethod(operationName = "echoToFile")
290
		echo.setTaskName("toFile");
-
 
291
		RunTask runTask = new RunTask(echo);
-
 
292
		echo.addText(message);
-
 
293
		echo.setEncoding(encoding);
-
 
294
		File f = new File(file);
-
 
295
		try {
-
 
296
			if (!f.canWrite())
-
 
297
 
296
	public ReturnCode echo2file(@WebParam(name = "message") String message,
298
				throw new XServicesFault("Cannot write to file: "
-
 
299
						+ f.getCanonicalPath());
-
 
300
 
-
 
301
			echo.setFile(f);
-
 
302
			echo.setAppend(append);
297
			@WebParam(name = "file") String file,
303
			ReturnCode c = runTask.postTask();
-
 
304
			return c;
-
 
305
		} catch (BuildException e) {
298
			@WebParam(name = "encoding") String encoding,
306
			throw new XServicesFault("Error in echo2file.", e);
299
			@WebParam(name = "append") boolean append) {
307
		} catch (IOException e) {
300
		return echo(message, new File(file), encoding, append);
308
			throw new XServicesFault("Cannot write to file.", e);
-
 
309
		}
301
	}
310
	}
Line 302... Line 311...
302
 
311
 
303
	/*
312
	/*
304
	 * (non-Javadoc)
313
	 * (non-Javadoc)
305
	 * 
314
	 * 
306
	 * @see
315
	 * @see
307
	 * net.brutex.xservices.ws.impl.FileService#changeOwner(net.brutex.xservices
316
	 * net.brutex.xservices.ws.impl.FileService#changeOwner(net.brutex.xservices
308
	 * .types.FileSetResource, java.lang.String)
317
	 * .types.FileSetResource, java.lang.String)
309
	 */
318
	 */
310
	@Override
319
	@Override
311
	@WebMethod(operationName = "changeOwner")
320
	public ReturnCode changeOwner(FileSetResource res, String owner) {
-
 
321
		Chown chown = new Chown();
312
	public ReturnCode changeOwner(
322
		chown.setTaskName("Chown");
313
			@WebParam(name = "fileset") FileSetResource res,
323
		RunTask runner = new RunTask(chown);
-
 
324
		chown.setOwner(owner);
-
 
325
		FileSet set = res.getAntResource(chown.getProject());
-
 
326
		chown.add(set);
314
			@WebParam(name = "owner") String owner) {
327
		chown.setMaxParallel(300);
315
		return chown(res, owner);
328
		return runner.postTask();
Line 316... Line 329...
316
	}
329
	}
317
 
330
 
318
	/*
331
	/*
319
	 * (non-Javadoc)
332
	 * (non-Javadoc)
320
	 * 
333
	 * 
321
	 * @see
334
	 * @see
322
	 * net.brutex.xservices.ws.impl.FileService#changeGroup(net.brutex.xservices
335
	 * net.brutex.xservices.ws.impl.FileService#changeGroup(net.brutex.xservices
323
	 * .types.FileSetResource, java.lang.String)
336
	 * .types.FileSetResource, java.lang.String)
324
	 */
337
	 */
325
	@Override
338
	@Override
-
 
339
	public ReturnCode changeGroup(FileSetResource res, String group) {
326
	@WebMethod(operationName = "changeGroup")
340
		Chgrp chgrp = new Chgrp();
327
	public ReturnCode changeGroup(
341
		chgrp.setTaskName("Chgrp");
-
 
342
		RunTask runner = new RunTask(chgrp);
-
 
343
		chgrp.setGroup(group);
-
 
344
		FileSet set = res.getAntResource(chgrp.getProject());
328
			@WebParam(name = "fileset") FileSetResource res,
345
		chgrp.add(set);
329
			@WebParam(name = "group") String group) {
346
		chgrp.setMaxParallel(300);
Line 330... Line 347...
330
		return chgrp(res, group);
347
		return runner.postTask();
331
	}
348
	}
332
 
349
 
333
	/*
350
	/*
334
	 * (non-Javadoc)
351
	 * (non-Javadoc)
335
	 * 
352
	 * 
336
	 * @see
353
	 * @see
337
	 * net.brutex.xservices.ws.impl.FileService#changeMode(net.brutex.xservices
354
	 * net.brutex.xservices.ws.impl.FileService#changeMode(net.brutex.xservices
338
	 * .types.FileSetResource, java.lang.String)
-
 
339
	 */
-
 
340
	@Override
-
 
341
	@WebMethod(operationName = "changeMode")
-
 
342
	public ReturnCode changeMode(
-
 
343
			@WebParam(name = "fileset") FileSetResource res,
-
 
344
			@WebParam(name = "permissions") String perm) {
-
 
345
		return chmod(res, perm);
-
 
346
	}
-
 
347
 
-
 
348
	@WebMethod(exclude = true)
-
 
349
	private ReturnCode echo(String msg, File file, String encoding,
-
 
350
			boolean append) {
-
 
351
		Echo echo = new Echo();
-
 
352
		echo.setTaskName("toFile");
-
 
353
		RunTask runTask = new RunTask(echo);
-
 
354
		echo.addText(msg);
-
 
355
		echo.setEncoding(encoding);
-
 
356
		echo.setFile(file);
-
 
357
		echo.setAppend(append);
-
 
358
		return runTask.postTask();
-
 
359
	}
-
 
360
 
-
 
361
	@WebMethod(exclude = true)
-
 
362
	private ReturnCode copy(FileSetResource src, File dst,
-
 
363
			boolean preservelastmodified, boolean overwrite, String encoding) {
-
 
364
		Copy copy = new Copy();
-
 
365
		copy.setTaskName("Copy");
-
 
366
		RunTask runner = new RunTask(copy);
-
 
367
		FileSet set = src.getAntResource(copy.getProject());
-
 
368
		copy.add(set);
-
 
369
 
-
 
370
		if (dst.isDirectory()) {
-
 
371
			copy.setTodir(dst);
-
 
372
		}
-
 
373
		if (dst.isFile()) {
-
 
374
			copy.setTofile(dst);
-
 
375
		}
-
 
376
		copy.setOverwrite(overwrite);
-
 
377
		copy.setPreserveLastModified(preservelastmodified);
-
 
378
		if (encoding != null && !encoding.equals("")) {
-
 
379
			copy.setOutputEncoding(encoding);
-
 
380
		} else {
-
 
381
			copy.setOutputEncoding(System.getProperty("file.encoding"));
-
 
382
		}
-
 
383
 
-
 
384
		return runner.postTask();
-
 
385
	}
-
 
386
 
-
 
387
	@WebMethod(exclude = true)
-
 
388
	private ReturnCode chown(FileSetResource src, String owner) {
-
 
389
		Chown chown = new Chown();
-
 
390
		chown.setTaskName("Chown");
-
 
391
		RunTask runner = new RunTask(chown);
-
 
392
		chown.setOwner(owner);
-
 
393
		FileSet set = src.getAntResource(chown.getProject());
-
 
394
		chown.add(set);
-
 
395
		chown.setMaxParallel(300);
-
 
396
		return runner.postTask();
-
 
397
	}
-
 
398
 
-
 
399
	@WebMethod(exclude = true)
-
 
400
	private ReturnCode chgrp(FileSetResource src, String group) {
-
 
401
		Chgrp chgrp = new Chgrp();
-
 
402
		chgrp.setTaskName("Chgrp");
-
 
403
		RunTask runner = new RunTask(chgrp);
-
 
404
		chgrp.setGroup(group);
-
 
405
		FileSet set = src.getAntResource(chgrp.getProject());
-
 
406
		chgrp.add(set);
-
 
407
		chgrp.setMaxParallel(300);
-
 
408
		return runner.postTask();
-
 
409
	}
355
	 * .types.FileSetResource, java.lang.String)
410
 
356
	 */
411
	@WebMethod(exclude = true)
357
	@Override
412
	private ReturnCode chmod(FileSetResource src, String perm) {
358
	public ReturnCode changeMode(FileSetResource res, String perm) {
413
		Chmod chmod = new Chmod();
359
		Chmod chmod = new Chmod();
414
		chmod.setTaskName("Chmod");
360
		chmod.setTaskName("Chmod");
415
		RunTask runner = new RunTask(chmod);
361
		RunTask runner = new RunTask(chmod);
416
		FileSet set = src.getAntResource(chmod.getProject());
362
		FileSet set = res.getAntResource(chmod.getProject());
417
		chmod.add(set);
363
		chmod.add(set);
418
		chmod.setMaxParallel(300);
364
		chmod.setMaxParallel(300);