Subversion Repositories XServices

Rev

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

Rev 72 Rev 78
Line 16... Line 16...
16
 
16
 
Line 17... Line 17...
17
package net.brutex.xservices.ws.impl;
17
package net.brutex.xservices.ws.impl;
18
 
18
 
-
 
19
import java.util.Enumeration;
Line 19... Line 20...
19
import java.util.Enumeration;
20
import java.util.Properties;
20
import java.util.Properties;
21
import java.util.UUID;
21
 
22
 
-
 
23
import javax.jws.WebService;
22
import javax.jws.WebService;
24
import net.brutex.xservices.types.FileSetResource;
23
import net.brutex.xservices.types.FileSetResource;
25
import net.brutex.xservices.types.HostConnection;
24
import net.brutex.xservices.types.HostConnection;
26
import net.brutex.xservices.types.HostinfoType;
25
import net.brutex.xservices.types.MailMimeType;
27
import net.brutex.xservices.types.MailMimeType;
26
import net.brutex.xservices.types.ReturnCode;
28
import net.brutex.xservices.types.ReturnCode;
Line 36... Line 38...
36
 
38
 
37
/**
39
/**
38
 * 
40
 * 
39
 * @author Brian Rosenberger, bru@brutex.de
41
 * @author Brian Rosenberger, bru@brutex.de
40
 */
-
 
41
@WebService(
-
 
42
		targetNamespace = BrutexNamespaces.WS_XSERVICES, 
42
 */
43
		endpointInterface = "net.brutex.xservices.ws.MiscService", 
-
 
44
		serviceName = "MiscService"
-
 
45
			)
43
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.MiscService", serviceName = "MiscService")
Line 46... Line 44...
46
public class MiscServiceImpl implements MiscService {
44
public class MiscServiceImpl implements MiscService {
-
 
45
 
-
 
46
	public HostinfoType getHostinfo(String hostname) {
-
 
47
		HostInfo info = new HostInfo();
47
 
48
		info.setTaskName("HostInfo");
-
 
49
		RunTask runner = new RunTask(info);
-
 
50
		info.setHost(hostname);
-
 
51
		// info.setPrefix(prefix);
-
 
52
		ReturnCode ret = runner.postTask();
-
 
53
		HostinfoType infotype = new HostinfoType(
-
 
54
				ret.getProperty("NAME"),
-
 
55
				ret.getProperty("DOMAIN"), 
-
 
56
				ret.getProperty("ADDR4"),
48
	public ReturnCode getHostinfo(String hostname) {
57
				ret.getProperty("ADDR6"));
49
		return antGetHostinfo(hostname, null);
58
		return infotype;
50
	}
59
	}
51
	
60
 
52
	public ReturnCode getInfo() {
61
	public ReturnCode getInfo() {
53
		ReturnCode r = new ReturnCode();
62
		ReturnCode r = new ReturnCode();
54
		r.returnCode = 0;
63
		r.returnCode = 0;
Line 55... Line 64...
55
		// Get all system properties
64
		// Get all system properties
-
 
65
		Properties props = System.getProperties();
56
		Properties props = System.getProperties();
66
 
57
 
67
		// Enumerate all system properties
58
		// Enumerate all system properties
68
		@SuppressWarnings("unchecked")
59
		Enumeration<String> e = (Enumeration<String>) props.propertyNames();
69
		Enumeration<String> e = (Enumeration<String>) props.propertyNames();
60
		for (; e.hasMoreElements(); ) {
70
		for (; e.hasMoreElements();) {
61
		    // Get property name
71
			// Get property name
62
		    String propName = (String)e.nextElement();
72
			String propName = (String) e.nextElement();
63
 
73
 
64
		    // Get property value
74
			// Get property value
Line 65... Line 75...
65
		    String propValue = (String)props.get(propName);
75
			String propValue = (String) props.get(propName);
66
		    r.stdOut = r.stdOut + propName + ": " + propValue + "\n";
76
			r.stdOut = r.stdOut + propName + ": " + propValue + "\n";
Line 67... Line -...
67
		}
-
 
68
 
77
		}
69
		return r;
78
 
70
	}
79
		return r;
71
 
80
	}
72
 
81
 
Line 96... Line 105...
96
 
105
 
97
	public ReturnCode sleep(int minutes, int seconds) {
106
	public ReturnCode sleep(int minutes, int seconds) {
98
		return sleep(0, minutes, seconds, 0);
107
		return sleep(0, minutes, seconds, 0);
Line 99... Line -...
99
	}
-
 
100
 
108
	}
101
	private ReturnCode antGetHostinfo(String hostname, String prefix) {
-
 
102
		HostInfo info = new HostInfo();
-
 
103
		info.setTaskName("HostInfo");
-
 
104
		RunTask runner = new RunTask(info);
-
 
105
		info.setHost(hostname);
109
 
106
		// info.setPrefix(prefix);
110
	public String generateUUID() {
Line 107... Line 111...
107
		return runner.postTask();
111
		return UUID.randomUUID().toString();
108
	}
112
	}
109
 
113