Subversion Repositories XServices

Rev

Rev 14 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14 Rev 46
Line 11... Line 11...
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;
16
package net.brutex.xservices.ws.impl;
Line 17... Line 17...
17
 
17
 
18
import java.io.File;
18
import java.io.File;
19
import javax.jws.WebMethod;
19
import javax.jws.WebMethod;
20
import javax.jws.WebParam;
20
import javax.jws.WebParam;
21
import javax.jws.WebService;
21
import javax.jws.WebService;
22
import net.brutex.xservices.types.ArchiveResource;
22
import net.brutex.xservices.types.ArchiveResource;
23
import net.brutex.xservices.types.FileResource;
23
import net.brutex.xservices.types.FileResource;
24
import net.brutex.xservices.types.FileSetResource;
24
import net.brutex.xservices.types.FileSetResource;
25
import net.brutex.xservices.types.ResourceInterface;
25
import net.brutex.xservices.types.ResourceInterface;
-
 
26
import net.brutex.xservices.types.ReturnCode;
26
import net.brutex.xservices.types.ReturnCode;
27
import net.brutex.xservices.util.BrutexNamespaces;
-
 
28
import net.brutex.xservices.util.RunTask;
-
 
29
import net.brutex.xservices.ws.FileService;
-
 
30
import net.brutex.xservices.ws.XServicesFault;
27
import net.brutex.xservices.util.RunTask;
31
 
28
import org.apache.tools.ant.taskdefs.Basename;
32
import org.apache.tools.ant.taskdefs.Basename;
29
import org.apache.tools.ant.taskdefs.Chmod;
33
import org.apache.tools.ant.taskdefs.Chmod;
30
import org.apache.tools.ant.taskdefs.Copy;
34
import org.apache.tools.ant.taskdefs.Copy;
31
import org.apache.tools.ant.taskdefs.Echo;
35
import org.apache.tools.ant.taskdefs.Echo;
Line 36... Line 40...
36
 
40
 
37
/**
41
/**
38
 *
42
 *
39
 * @author Brian Rosenberger, bru@brutex.de
43
 * @author Brian Rosenberger, bru@brutex.de
-
 
44
 */
-
 
45
@WebService(
40
 */
46
		targetNamespace = BrutexNamespaces.WS_XSERVICES, 
41
@WebService(targetNamespace = "http://ws.xservices.brutex.net", name = "FileService")
47
		endpointInterface ="net.brutex.xservices.ws.FileService", 
-
 
48
		name = "FileService"
-
 
49
			)
42
public class FileService {
50
public class FileServiceImpl implements FileService {
-
 
51
 
-
 
52
    /* (non-Javadoc)
-
 
53
	 * @see net.brutex.xservices.ws.impl.FileService#basename(java.lang.String, java.lang.String)
-
 
54
	 */
43
 
55
    @Override
44
    @WebMethod(operationName = "basename")
56
	@WebMethod(operationName = "basename")
45
    public ReturnCode basename(@WebParam(name = "file") String filename,
57
    public ReturnCode basename(@WebParam(name = "file") String filename,
46
            @WebParam(name = "suffix") String suffix) {
58
            @WebParam(name = "suffix") String suffix) {
47
        return basename(new File(filename), suffix);
59
        return basename(new File(filename), suffix);
Line -... Line 60...
-
 
60
    }
-
 
61
 
-
 
62
    /* (non-Javadoc)
-
 
63
	 * @see net.brutex.xservices.ws.impl.FileService#copy(net.brutex.xservices.types.FileSetResource, java.lang.String, boolean, boolean, java.lang.String)
48
    }
64
	 */
49
 
65
    @Override
50
    @WebMethod(operationName = "copy")
66
	@WebMethod(operationName = "copy")
51
    public ReturnCode copy(@WebParam(name = "fileset") FileSetResource src,
67
    public ReturnCode copy(@WebParam(name = "fileset") FileSetResource src,
52
            @WebParam(name = "todir") String todir,
68
            @WebParam(name = "todir") String todir,
53
            @WebParam(name = "preservelastmodified") boolean plm,
69
            @WebParam(name = "preservelastmodified") boolean plm,
54
            @WebParam(name = "overwrite") boolean overwrite,
70
            @WebParam(name = "overwrite") boolean overwrite,
55
            @WebParam(name = "encoding") String encoding)
71
            @WebParam(name = "encoding") String encoding)
56
            throws XServicesFault {
72
            throws XServicesFault {
Line -... Line 73...
-
 
73
        return copy(src, new File(todir), plm, overwrite, encoding);
-
 
74
    }
-
 
75
 
-
 
76
    /* (non-Javadoc)
57
        return copy(src, new File(todir), plm, overwrite, encoding);
77
	 * @see net.brutex.xservices.ws.impl.FileService#loadRes(net.brutex.xservices.types.FileResource, java.lang.String)
58
    }
78
	 */
59
 
79
    @Override
60
    @WebMethod(operationName = "loadResource")
80
	@WebMethod(operationName = "loadResource")
61
    public ReturnCode loadRes(@WebParam(name = "resource") FileResource res,
81
    public ReturnCode loadRes(@WebParam(name = "resource") FileResource res,
62
            @WebParam(name = "encoding") String encoding) {
82
            @WebParam(name = "encoding") String encoding) {
63
        if (encoding == null || encoding.equals("")) {
83
        if (encoding == null || encoding.equals("")) {
64
            encoding = System.getProperty("file.encoding");
84
            encoding = System.getProperty("file.encoding");
Line -... Line 85...
-
 
85
        }
-
 
86
        return loadResource(res, encoding);
-
 
87
    }
-
 
88
 
65
        }
89
    /* (non-Javadoc)
66
        return loadResource(res, encoding);
90
	 * @see net.brutex.xservices.ws.impl.FileService#loadResFromArchive(net.brutex.xservices.types.ArchiveResource, java.lang.String)
67
    }
91
	 */
68
 
92
    @Override
69
    @WebMethod(operationName = "loadResourceFromArchive")
93
	@WebMethod(operationName = "loadResourceFromArchive")
70
    public ReturnCode loadResFromArchive(@WebParam(name = "archiveresource") ArchiveResource res,
94
    public ReturnCode loadResFromArchive(@WebParam(name = "archiveresource") ArchiveResource res,
71
            @WebParam(name = "encoding") String encoding) {
95
            @WebParam(name = "encoding") String encoding) {
72
        if (encoding == null || encoding.equals("")) {
96
        if (encoding == null || encoding.equals("")) {
Line -... Line 97...
-
 
97
            encoding = System.getProperty("file.encoding");
-
 
98
        }
-
 
99
        return loadResource(res, encoding);
-
 
100
    }
73
            encoding = System.getProperty("file.encoding");
101
 
74
        }
102
    /* (non-Javadoc)
75
        return loadResource(res, encoding);
103
	 * @see net.brutex.xservices.ws.impl.FileService#echo2file(java.lang.String, java.lang.String, java.lang.String, boolean)
76
    }
104
	 */
77
 
105
    @Override
78
    @WebMethod(operationName = "echoToFile")
106
	@WebMethod(operationName = "echoToFile")
Line -... Line 107...
-
 
107
    public ReturnCode echo2file(@WebParam(name = "message") String message,
-
 
108
            @WebParam(name = "file") String file, @WebParam(name = "encoding") String encoding,
-
 
109
            @WebParam(name = "append") boolean append) {
-
 
110
        return echo(message, new File(file), encoding, append);
79
    public ReturnCode echo2file(@WebParam(name = "message") String message,
111
    }
80
            @WebParam(name = "file") String file, @WebParam(name = "encoding") String encoding,
112
 
81
            @WebParam(name = "append") boolean append) {
113
    /* (non-Javadoc)
82
        return echo(message, new File(file), encoding, append);
114
	 * @see net.brutex.xservices.ws.impl.FileService#changeOwner(net.brutex.xservices.types.FileSetResource, java.lang.String)
83
    }
115
	 */
Line -... Line 116...
-
 
116
    @Override
-
 
117
	@WebMethod(operationName = "changeOwner")
-
 
118
    public ReturnCode changeOwner(@WebParam(name = "fileset") FileSetResource res,
-
 
119
            @WebParam(name = "owner") String owner) {
84
 
120
        return chown(res, owner);
85
    @WebMethod(operationName = "changeOwner")
121
    }
86
    public ReturnCode changeOwner(@WebParam(name = "fileset") FileSetResource res,
122
 
87
            @WebParam(name = "owner") String owner) {
123
    /* (non-Javadoc)
88
        return chown(res, owner);
124
	 * @see net.brutex.xservices.ws.impl.FileService#changeGroup(net.brutex.xservices.types.FileSetResource, java.lang.String)
Line -... Line 125...
-
 
125
	 */
-
 
126
    @Override
-
 
127
	@WebMethod(operationName = "changeGroup")
-
 
128
    public ReturnCode changeGroup(@WebParam(name = "fileset") FileSetResource res,
89
    }
129
            @WebParam(name = "group") String group) {
90
 
130
        return chgrp(res, group);
91
    @WebMethod(operationName = "changeGroup")
131
    }
92
    public ReturnCode changeGroup(@WebParam(name = "fileset") FileSetResource res,
132
 
93
            @WebParam(name = "group") String group) {
133
    /* (non-Javadoc)