SoapParam.java
3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package com.sitech.ismp.coll.tivoli.linux;
import java.net.InetAddress;
import java.util.ResourceBundle;
/**
* 该类负责的读取tivoli.properties配置文件
* 得到相关配置信息
*
* @author winnerbao
*
*/
public class SoapParam
{
/*
public static final String RMIPORT = "RMIPORT";
public static final String HTMLROOTDIR = "HTMLROOTDIR";
public static final String HTMLPORT = "HTMLPORT";
public static final String HTTPADAPTORPORT = "HTTPADAPTORPORT";
public static final String HOSTADDRESS = "HOSTADDRESS";
public static final String JMXSERVICEURLADDRESSPORT = "JMXSERVICEURLADDRESSPORT";
*/
static ResourceBundle MASTERAGENTINFO = null;
static {
try{
MASTERAGENTINFO = ResourceBundle.getBundle("tivoli");
/*
String rmiport = LogfileInfo.getString(RMIPORT);
String syslogFile = LogfileInfo.getString(HTMLROOTDIR);
String syslogFile = LogfileInfo.getString(HTMLPORT);
String syslogFile = LogfileInfo.getString(JMXSERVICEURLADDRESSPORT);
String syslogFile = LogfileInfo.getString(HTTPADAPTORPORT);
// String syslogFile = LogfileInfo.getString(HOSTADDRESS);
String hostaddress = InetAddress.getLocalHost().toString();
*/
}
catch(Exception e){
System.out.println("Bundle MASTERAGENT.properties error.");
e.printStackTrace();
}
}
public static int getInt(String paramname) {
// ResourceBundle MASTERAGENTINFO = ResourceBundle.getBundle("MASTERAGENT");
int paramvalue = 0;
try{
String cParamvalue = (String)MASTERAGENTINFO.getString(paramname);
paramvalue = Integer.parseInt(cParamvalue);
}
catch(Exception e){
System.out.println("get param " + paramname + "error.");
e.printStackTrace();
}
return paramvalue;
}
public static String getString(String paramname) {
// ResourceBundle MASTERAGENTINFO = ResourceBundle.getBundle("MASTERAGENT");
if(paramname!=null && paramname.equals("HOSTADDR")){
return getHOSTADDR();
}
Object value = MASTERAGENTINFO.getString(paramname);
String paramvalue = null;
if(value==null)
paramvalue="";
else
paramvalue = (String)value;
return paramvalue;
}
public static String getHOSTADDR() {
String paramvalue = "127.0.0.1";
try{
paramvalue = InetAddress.getLocalHost().toString();
}
catch(Exception e){
e.printStackTrace();
}
return paramvalue;
}
}