📄 init.java
字号:
import java.util.Properties;
import com.ibm.websphere.management.*;
public class Init {
// public static final String HOST_NAME = "localhost";
//
// public static final String HOST_PORT = "8880";
//
// public static final String CONNECT_TYPE = AdminClient.CONNECTOR_TYPE_SOAP;
//
// public static final String NODE = "worksoft-zyNode01";
//
// public static final String SERVER = "server1";
//
// public final static String CONFIGFILE_PATH = "D:/worktest/test_websphere1/";
//
// public final static String CONFIGFILE_NAME = "cmcol.cfg";
//
// public final static String WEBSPHERE_DATA_FILE = "WebsphereOriginal0.data";
private AdminClient adminClient;
private String hostname;
private String hostport;
private String connecttype;
private WebsphereConfigure configure=new WebsphereConfigure();
/*
* init and create the AdminClient
*/
public Init() {
initialize();
}
public void initialize() {
hostname = configure.getHostName();
hostport = configure.getHostPort();
connecttype = configure.getConnectType();
}
public AdminClient getAdminClient() {
try {
Properties adminProps = new Properties();
adminProps.setProperty(AdminClient.CONNECTOR_TYPE, connecttype);
adminProps.setProperty(AdminClient.CONNECTOR_HOST, hostname);
adminProps.setProperty(AdminClient.CONNECTOR_PORT, hostport);
adminClient = AdminClientFactory.createAdminClient(adminProps);
} catch (Exception ex) {
System.out.println("Exception to create AdminClient: " + ex);
}
return adminClient;
}
public static void main(String[] args) {
Init init = new Init();
try {
AdminClient a = init.getAdminClient();
System.out.println("got the admin client : " + a.getDomainName());
} catch (Exception e) {
System.err.println("The error is " + e.getMessage());
}
System.exit(0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -