Subversion Repositories XServices

Compare Revisions

Ignore whitespace Rev 77 → Rev 78

/xservices/trunk/src/java/net/brutex/xservices/ws/impl/MiscServiceImpl.java
18,10 → 18,12
 
import java.util.Enumeration;
import java.util.Properties;
import java.util.UUID;
 
import javax.jws.WebService;
import net.brutex.xservices.types.FileSetResource;
import net.brutex.xservices.types.HostConnection;
import net.brutex.xservices.types.HostinfoType;
import net.brutex.xservices.types.MailMimeType;
import net.brutex.xservices.types.ReturnCode;
import net.brutex.xservices.util.BrutexNamespaces;
38,17 → 40,24
*
* @author Brian Rosenberger, bru@brutex.de
*/
@WebService(
targetNamespace = BrutexNamespaces.WS_XSERVICES,
endpointInterface = "net.brutex.xservices.ws.MiscService",
serviceName = "MiscService"
)
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.MiscService", serviceName = "MiscService")
public class MiscServiceImpl implements MiscService {
 
public ReturnCode getHostinfo(String hostname) {
return antGetHostinfo(hostname, null);
public HostinfoType getHostinfo(String hostname) {
HostInfo info = new HostInfo();
info.setTaskName("HostInfo");
RunTask runner = new RunTask(info);
info.setHost(hostname);
// info.setPrefix(prefix);
ReturnCode ret = runner.postTask();
HostinfoType infotype = new HostinfoType(
ret.getProperty("NAME"),
ret.getProperty("DOMAIN"),
ret.getProperty("ADDR4"),
ret.getProperty("ADDR6"));
return infotype;
}
 
public ReturnCode getInfo() {
ReturnCode r = new ReturnCode();
r.returnCode = 0;
56,20 → 65,20
Properties props = System.getProperties();
 
// Enumerate all system properties
@SuppressWarnings("unchecked")
Enumeration<String> e = (Enumeration<String>) props.propertyNames();
for (; e.hasMoreElements(); ) {
// Get property name
String propName = (String)e.nextElement();
for (; e.hasMoreElements();) {
// Get property name
String propName = (String) e.nextElement();
 
// Get property value
String propValue = (String)props.get(propName);
r.stdOut = r.stdOut + propName + ": " + propValue + "\n";
// Get property value
String propValue = (String) props.get(propName);
r.stdOut = r.stdOut + propName + ": " + propValue + "\n";
}
 
return r;
}
 
 
public ReturnCode sendMailSimple(HostConnection mailhost, String from,
String tolist, String subject, String message) {
return sendMail(from, from, tolist, "", "", subject, message,
98,13 → 107,8
return sleep(0, minutes, seconds, 0);
}
 
private ReturnCode antGetHostinfo(String hostname, String prefix) {
HostInfo info = new HostInfo();
info.setTaskName("HostInfo");
RunTask runner = new RunTask(info);
info.setHost(hostname);
// info.setPrefix(prefix);
return runner.postTask();
public String generateUUID() {
return UUID.randomUUID().toString();
}
 
private ReturnCode sendMail(String from, String replyto, String tolist,
/xservices/trunk/src/java/net/brutex/xservices/ws/MiscService.java
20,9 → 20,12
import javax.jws.WebService;
import net.brutex.xservices.types.FileSetResource;
import net.brutex.xservices.types.HostConnection;
import net.brutex.xservices.types.HostinfoType;
import net.brutex.xservices.types.MailMimeType;
import net.brutex.xservices.types.ReturnCode;
import net.brutex.xservices.util.BrutexNamespaces;
 
import org.apache.cxf.aegis.type.java5.XmlElement;
import org.apache.cxf.annotations.WSDLDocumentation;
import org.apache.cxf.annotations.WSDLDocumentationCollection;
 
43,8 → 46,8
*/
@WebMethod(operationName = "getHostinfo")
@WSDLDocumentation(value = "Get information about a host.")
public ReturnCode getHostinfo(
@WebParam(name = "hostname") String hostname);
public HostinfoType getHostinfo(
@WebParam(name = "hostname") @XmlElement(minOccurs="1", nillable=false ) String hostname);
 
/**
*
132,4 → 135,12
@WSDLDocumentation(value = "Get XService information.")
public ReturnCode getInfo();
/**
* Generate a UUID
* @return new UUID
*/
@WebMethod(operationName = "generateUUID")
@WSDLDocumentation(value = "Generate a UUID.")
public String generateUUID();
}