public class Util
extends java.lang.Object
The Util class for this package contains some convenience methods. This class will try to find the/a properties file and load the properties.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BIND |
static java.lang.String |
COMM |
static java.lang.String |
HOST |
static java.lang.String |
INTERVAL |
static java.lang.String |
OID |
static java.lang.String |
PORT |
static java.lang.String |
SOCKETTYPE |
Constructor and Description |
---|
Util(java.lang.String propertiesFilename,
java.lang.String classname)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getBindAddress()
Returns the
bind property. |
java.lang.String |
getCommunity()
Returns the
comm property. |
static java.lang.String |
getDefaultPropertiesFilename(java.lang.String classname) |
java.lang.String |
getHost()
Returns the
host property. |
int |
getIntParameter(java.lang.String key,
int def)
Return the integer value of a property.
|
static int |
getNumber(java.lang.String str) |
java.lang.String |
getOid(java.lang.String def)
Returns the
oid property. |
java.lang.String |
getPort()
Returns the
port property. |
int |
getPort(int def)
Returns the
port property. |
java.lang.String |
getProperty(java.lang.String key) |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue) |
java.lang.String |
getSocketType()
Returns the
sockettype property. |
static boolean |
isNumber(java.lang.String str) |
static java.lang.String |
myHost()
Returns the name of the localhost.
|
public static final java.lang.String HOST
public static final java.lang.String BIND
public static final java.lang.String PORT
public static final java.lang.String SOCKETTYPE
public static final java.lang.String COMM
public static final java.lang.String OID
public static final java.lang.String INTERVAL
public Util(java.lang.String propertiesFilename, java.lang.String classname)
<classname>.properties
.
propertiesFilename
- The name of the properties file. Can be
null.classname
- The full name of the class using this class.public static java.lang.String getDefaultPropertiesFilename(java.lang.String classname)
public static java.lang.String myHost()
localhost
.public java.lang.String getHost()
host
property.host
property.HOST
public java.lang.String getBindAddress()
bind
property.bind
property.BIND
public java.lang.String getPort()
port
property.port
property.PORT
public int getPort(int def)
port
property.def
- The default value.port
property.PORT
public java.lang.String getSocketType()
sockettype
property. The default value will
be the standard socket.sockettype
property.SOCKETTYPE
,
SnmpContextBasisFace.STANDARD_SOCKET
public java.lang.String getCommunity()
comm
property. The default value will
be the default community name.comm
property.COMM
,
SnmpContextFace.DEFAULT_COMMUNITY
public java.lang.String getOid(java.lang.String def)
oid
property.def
- The default value.oid
property.OID
public java.lang.String getProperty(java.lang.String key)
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
public int getIntParameter(java.lang.String key, int def)
key
, or the value is not an integer, the default value
is returned.key
- The keydef
- The default valuepublic static boolean isNumber(java.lang.String str)
public static int getNumber(java.lang.String str)