Subversion Repositories XServices

Rev

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