moving list method to Service class

This commit is contained in:
Doug MacEachern 2005-06-27 01:18:44 +00:00
parent b342c2aca2
commit 53430acdcc
2 changed files with 16 additions and 16 deletions

View File

@ -1,5 +1,6 @@
package net.hyperic.sigar.win32;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.List;
@ -294,6 +295,20 @@ public class Service extends Win32 {
private static native boolean QueryServiceConfig(long handle,
ServiceConfig config) throws Win32Exception;
public void list(PrintStream out) throws Win32Exception {
ServiceConfig config = getConfig();
out.println("display.......[" + config.getDisplayName() + "]");
out.println("description...[" + config.getDescription() + "]");
out.println("status........[" + getStatusString() + "]");
out.println("start type....[" + config.getStartTypeString() + "]");
out.println("start name....[" + config.getServiceStartName() + "]");
out.println("type.........." + config.getTypeList());
out.println("path..........[" + config.getPath() + "]");
out.println("deps.........." + Arrays.asList(config.getDependencies()));
out.println("error ctl.....[" + config.getErrorControlString() + "]");
}
public static void main(String[] args) throws Exception {
List services;
if (args.length == 0) {
@ -320,9 +335,7 @@ public class Service extends Win32 {
for (int i=0; i<services.size(); i++) {
String name = (String)services.get(i);
Service service = new Service(name);
service.getConfig().list(System.out);
System.out.println("status........[" +
service.getStatusString() + "]");
service.list(System.out);
System.out.println("");
}
}

View File

@ -1,8 +1,6 @@
package net.hyperic.sigar.win32;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ServiceConfig {
@ -298,15 +296,4 @@ public class ServiceConfig {
public void setName(String name) {
this.name = name;
}
public void list(PrintStream out) {
out.println("name..........[" + getName() + "]");
out.println("display.......[" + getDisplayName() + "]");
out.println("description...[" + getDescription() + "]");
out.println("path..........[" + getPath() + "]");
out.println("deps.........." + Arrays.asList(getDependencies()));
out.println("type.........." + getTypeList());
out.println("start type....[" + getStartTypeString() + "]");
out.println("error ctl.....[" + getErrorControlString() + "]");
}
}