Subversion Repositories XServices

Rev

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

Rev 19 Rev 46
Line 12... Line 12...
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
 */
Line 16... Line 16...
16
 
16
 
Line 17... Line 17...
17
package net.brutex.xservices.ws;
17
package net.brutex.xservices.ws.impl;
18
 
18
 
19
import java.io.File;
19
import java.io.File;
20
import javax.jws.WebMethod;
20
import javax.jws.WebMethod;
21
import javax.jws.WebParam;
21
import javax.jws.WebParam;
22
import javax.jws.WebService;
22
import javax.jws.WebService;
-
 
23
import net.brutex.xservices.types.HostConnection;
23
import net.brutex.xservices.types.HostConnection;
24
import net.brutex.xservices.types.ReturnCode;
-
 
25
import net.brutex.xservices.util.BrutexNamespaces;
-
 
26
import net.brutex.xservices.util.RunTask;
24
import net.brutex.xservices.types.ReturnCode;
27
import net.brutex.xservices.ws.ExecuteService;
25
import net.brutex.xservices.util.RunTask;
28
 
26
import org.apache.tools.ant.taskdefs.ExecTask;
29
import org.apache.tools.ant.taskdefs.ExecTask;
27
import org.apache.tools.ant.taskdefs.optional.net.RExecTask;
30
import org.apache.tools.ant.taskdefs.optional.net.RExecTask;
28
import org.apache.tools.ant.taskdefs.optional.net.TelnetTask;
31
import org.apache.tools.ant.taskdefs.optional.net.TelnetTask;
Line 29... Line 32...
29
import org.apache.tools.ant.taskdefs.optional.ssh.SSHExec;
32
import org.apache.tools.ant.taskdefs.optional.ssh.SSHExec;
30
import org.apache.tools.ant.types.Commandline;
33
import org.apache.tools.ant.types.Commandline;
31
 
34
 
32
/**
35
/**
-
 
36
 *
-
 
37
 * @author Brian Rosenberger, bru@brutex.de
33
 *
38
 */
34
 * @author Brian Rosenberger, bru@brutex.de
39
@WebService(
-
 
40
		targetNamespace=BrutexNamespaces.WS_XSERVICES, 
-
 
41
		endpointInterface="net.brutex.xservices.ws.ExecuteService",
Line -... Line 42...
-
 
42
		name="ExecuteService"
-
 
43
			)
-
 
44
public class ExecuteServiceImpl implements ExecuteService {
-
 
45
 
35
 */
46
    /* (non-Javadoc)
36
@WebService(targetNamespace="http://ws.xservices.brutex.net", name="ExecuteService")
47
	 * @see net.brutex.xservices.ws.impl.ExecuteService#runCommand(java.lang.String, java.lang.String, long)
37
public class ExecuteService {
48
	 */
38
 
49
    @Override
Line 50... Line 61...
50
                true,
61
                true,
51
                false,
62
                false,
52
                timeout);
63
                timeout);
53
    }
64
    }
Line -... Line 65...
-
 
65
 
-
 
66
    /* (non-Javadoc)
-
 
67
	 * @see net.brutex.xservices.ws.impl.ExecuteService#runCommandWithArgs(java.lang.String, java.lang.String[], long)
-
 
68
	 */
54
 
69
    @Override
55
    @WebMethod(operationName = "runCommandWithArgs")
70
	@WebMethod(operationName = "runCommandWithArgs")
56
    public ReturnCode runCommandWithArgs(@WebParam(name = "executable") String cmd,
71
    public ReturnCode runCommandWithArgs(@WebParam(name = "executable") String cmd,
57
            @WebParam(name = "arg") String[] args,
72
            @WebParam(name = "arg") String[] args,
Line 66... Line 81...
66
                true,
81
                true,
67
                false,
82
                false,
68
                timeout);
83
                timeout);
69
    }
84
    }
Line -... Line 85...
-
 
85
 
-
 
86
    /* (non-Javadoc)
-
 
87
	 * @see net.brutex.xservices.ws.impl.ExecuteService#runCommandAsync(java.lang.String, java.lang.String)
-
 
88
	 */
70
 
89
    @Override
71
    @WebMethod(operationName = "runCommandAsync")
90
	@WebMethod(operationName = "runCommandAsync")
72
    public ReturnCode runCommandAsync(@WebParam(name = "executable") String cmd,
91
    public ReturnCode runCommandAsync(@WebParam(name = "executable") String cmd,
Line 73... Line 92...
73
            @WebParam(name = "argline") String args) {
92
            @WebParam(name = "argline") String args) {
Line 81... Line 100...
81
                true,
100
                true,
82
                false,
101
                false,
83
                0);
102
                0);
84
    }
103
    }
Line -... Line 104...
-
 
104
 
-
 
105
    /* (non-Javadoc)
-
 
106
	 * @see net.brutex.xservices.ws.impl.ExecuteService#runCommandAsyncWithArgs(java.lang.String, java.lang.String[])
-
 
107
	 */
85
 
108
    @Override
86
    @WebMethod(operationName = "runCommandAsyncWithArgs")
109
	@WebMethod(operationName = "runCommandAsyncWithArgs")
87
    public ReturnCode runCommandAsyncWithArgs(@WebParam(name = "executable") String cmd,
110
    public ReturnCode runCommandAsyncWithArgs(@WebParam(name = "executable") String cmd,
Line 88... Line 111...
88
            @WebParam(name = "arg") String[] args) {
111
            @WebParam(name = "arg") String[] args) {
Line 96... Line 119...
96
                true,
119
                true,
97
                false,
120
                false,
98
                0);
121
                0);
99
    }
122
    }
Line -... Line 123...
-
 
123
 
-
 
124
    /* (non-Javadoc)
-
 
125
	 * @see net.brutex.xservices.ws.impl.ExecuteService#runCommandWithSSH(java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, long)
-
 
126
	 */
100
 
127
    @Override
101
    @WebMethod(operationName = "runCommandWithSSH")
128
	@WebMethod(operationName = "runCommandWithSSH")
102
    public ReturnCode runCommandWithSSH(@WebParam(name = "host") String host,
129
    public ReturnCode runCommandWithSSH(@WebParam(name = "host") String host,
103
            @WebParam(name = "port") int port,
130
            @WebParam(name = "port") int port,
104
            @WebParam(name = "username") String username,
131
            @WebParam(name = "username") String username,
Line 107... Line 134...
107
            @WebParam(name = "timeout") long timeout) {
134
            @WebParam(name = "timeout") long timeout) {
Line 108... Line 135...
108
 
135
 
109
        return sshExec(host, username, password, port, cmd, timeout);
136
        return sshExec(host, username, password, port, cmd, timeout);
Line -... Line 137...
-
 
137
    }
-
 
138
 
-
 
139
    /* (non-Javadoc)
-
 
140
	 * @see net.brutex.xservices.ws.impl.ExecuteService#runCommandWithSSHKeyAuth(java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, long)
110
    }
141
	 */
111
 
142
    @Override
112
    @WebMethod(operationName = "runCommandWithSSHKeyAuth")
143
	@WebMethod(operationName = "runCommandWithSSHKeyAuth")
113
    public ReturnCode runCommandWithSSHKeyAuth(@WebParam(name = "host") String host,
144
    public ReturnCode runCommandWithSSHKeyAuth(@WebParam(name = "host") String host,
114
            @WebParam(name = "port") int port,
145
            @WebParam(name = "port") int port,
Line 119... Line 150...
119
            @WebParam(name = "timeout") long timeout) {
150
            @WebParam(name = "timeout") long timeout) {
Line 120... Line 151...
120
 
151
 
121
        return sshExecWithCert(host, username, passphrase, keyfile, port, cmd, timeout);
152
        return sshExecWithCert(host, username, passphrase, keyfile, port, cmd, timeout);
Line -... Line 153...
-
 
153
    }
-
 
154
 
-
 
155
    /* (non-Javadoc)
-
 
156
	 * @see net.brutex.xservices.ws.impl.ExecuteService#rExec(net.brutex.xservices.types.HostConnection, java.lang.String, long)
122
    }
157
	 */
123
 
158
    @Override
124
    @WebMethod(operationName = "rExec")
159
	@WebMethod(operationName = "rExec")
125
    public ReturnCode rExec(@WebParam(name = "host") HostConnection host,
160
    public ReturnCode rExec(@WebParam(name = "host") HostConnection host,
126
            @WebParam(name = "command") String cmd,
161
            @WebParam(name = "command") String cmd,
127
            @WebParam(name = "timeout") long timeout) {
162
            @WebParam(name = "timeout") long timeout) {
Line -... Line 163...
-
 
163
        return rexec(host.hostname, host.port, host.user, host.password, cmd, timeout);
-
 
164
    }
-
 
165
 
-
 
166
    /* (non-Javadoc)
128
        return rexec(host.hostname, host.port, host.user, host.password, cmd, timeout);
167
	 * @see net.brutex.xservices.ws.impl.ExecuteService#runTelnet(net.brutex.xservices.types.HostConnection, java.lang.String, java.lang.String, java.lang.String, long)
129
    }
168
	 */
130
 
169
    @Override
131
    @WebMethod(operationName = "telnet")
170
	@WebMethod(operationName = "telnet")
132
    public ReturnCode runTelnet(@WebParam(name = "host") HostConnection host,
171
    public ReturnCode runTelnet(@WebParam(name = "host") HostConnection host,