Subversion Repositories XServices

Rev

Rev 17 | Rev 20 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17 Rev 18
Line 15... Line 15...
15
 */
15
 */
Line 16... Line 16...
16
 
16
 
Line 17... Line 17...
17
package net.brutex.xservices.ws;
17
package net.brutex.xservices.ws;
-
 
18
 
-
 
19
import javax.jws.WebService;
18
 
20
import net.brutex.xservices.types.FileSetResource;
19
import javax.jws.WebService;
21
import net.brutex.xservices.types.HostConnection;
20
import net.brutex.xservices.types.ReturnCode;
22
import net.brutex.xservices.types.ReturnCode;
-
 
23
import net.brutex.xservices.util.RunTask;
-
 
24
import org.apache.tools.ant.taskdefs.HostInfo;
Line 21... Line 25...
21
import net.brutex.xservices.util.RunTask;
25
import org.apache.tools.ant.taskdefs.email.EmailTask;
22
import org.apache.tools.ant.taskdefs.HostInfo;
26
import org.apache.tools.ant.taskdefs.email.Mailer;
23
 
27
 
24
/**
28
/**
25
 *
29
 *
26
 * @author Brian Rosenberger, bru@brutex.de
30
 * @author Brian Rosenberger, bru@brutex.de
27
 */
31
 */
Line 28... Line 32...
28
@WebService(endpointInterface="net.brutex.xservices.ws.MiscService",
32
@WebService(endpointInterface="net.brutex.xservices.ws.MiscService",
29
serviceName="MiscService")
33
serviceName="MiscService")
30
public class MiscServiceImpl implements MiscService {
34
public class MiscServiceImpl implements MiscService {
Line -... Line 35...
-
 
35
 
-
 
36
    public ReturnCode getHostinfo(String hostname) {
-
 
37
        return antGetHostinfo(hostname, null);
-
 
38
    }
-
 
39
 
-
 
40
    public ReturnCode sendMailSimple(HostConnection mailhost, String from, String tolist, String subject, String message) {
-
 
41
        return sendMail(from,
-
 
42
                from,
-
 
43
                tolist,
-
 
44
                "",
-
 
45
                "",
-
 
46
                subject,
-
 
47
                message,
-
 
48
                "text/plain",
-
 
49
                null,
-
 
50
                mailhost.hostname,
-
 
51
                mailhost.port,
-
 
52
                mailhost.user,
-
 
53
                mailhost.password,
-
 
54
                "utf-8",
-
 
55
                false,
31
 
56
                false);
32
    public ReturnCode getHostinfo(String hostname) {
57
    }
33
        return antGetHostinfo(hostname, "");
58
 
34
    }
59
 
35
 
60
 
36
    private ReturnCode antGetHostinfo(String hostname, String prefix) {
61
    private ReturnCode antGetHostinfo(String hostname, String prefix) {
-
 
62
        HostInfo info = new HostInfo();
-
 
63
        info.setTaskName("HostInfo");
-
 
64
        RunTask runner = new RunTask(info);
-
 
65
        info.setHost(hostname);
-
 
66
        //info.setPrefix(prefix);
-
 
67
        return runner.postTask();
-
 
68
    }
-
 
69
 
-
 
70
    private ReturnCode sendMail(String from,
-
 
71
            String replyto,
-
 
72
            String tolist,
-
 
73
            String cclist,
-
 
74
            String bcclist,
-
 
75
            String subject,
-
 
76
            String message,
-
 
77
            String messagemimetype,
-
 
78
            FileSetResource attachments,
-
 
79
            String mailhost,
-
 
80
            int mailport,
-
 
81
            String user,
-
 
82
            String password,
-
 
83
            String charset,
-
 
84
            boolean tls,
-
 
85
            boolean ssl) {
-
 
86
        EmailTask mail = new EmailTask();
-
 
87
        mail.setTaskName("Mail");
-
 
88
        RunTask runner = new RunTask(mail);
-
 
89
        mail.setFrom(from);
-
 
90
        mail.setReplyTo(replyto);
-
 
91
        mail.setToList(tolist);
-
 
92
        mail.setCcList(cclist);
-
 
93
        mail.setBccList(bcclist);
-
 
94
        mail.setSubject(subject);
-
 
95
        mail.setMessage(message);
-
 
96
        mail.setMessageMimeType(messagemimetype);
-
 
97
        if(attachments != null) {
-
 
98
            mail.addFileset(attachments.getAntFileSet(mail.getProject()));
-
 
99
        }
-
 
100
        mail.setMailhost(mailhost);
-
 
101
        mail.setMailport(mailport);
37
        HostInfo info = new HostInfo();
102
        mail.setUser(user);
38
        info.setTaskName("HostInfo");
103
        mail.setPassword(password);
Line 39... Line 104...
39
        RunTask runner = new RunTask(info);
104
        mail.setCharset(charset);