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 |
AUTH_PROTOCOL |
static java.lang.String |
BIND |
static java.lang.String |
CONTEXT_ENGINE_ID |
static java.lang.String |
CONTEXT_NAME |
static java.lang.String |
HOST |
static java.lang.String |
OID |
static java.lang.String |
PORT |
static java.lang.String |
PRIV_PROTOCOL |
static java.lang.String |
SOCKETTYPE |
static java.lang.String |
USE_AUTHENTICATION |
static java.lang.String |
USE_PRIVACY |
static java.lang.String |
USER_AUTH_PASSWORD |
static java.lang.String |
USER_PRIV_PASSWORD |
static java.lang.String |
USERNAME |
Constructor and Description |
---|
Util(java.lang.String propertiesFilename,
java.lang.String classname)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getAuthProcotol() |
java.lang.String |
getBindAddress()
Returns the
bind property. |
byte[] |
getContextEngineId() |
java.lang.String |
getContextEngineIdStr() |
java.lang.String |
getContextName() |
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. |
int |
getPrivProcotol() |
java.io.File |
getPropertiesFile() |
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. |
int |
getUseAuth() |
int |
getUsePriv() |
java.lang.String |
getUserAuthPassword() |
java.lang.String |
getUserName() |
java.lang.String |
getUserPrivPassword() |
static boolean |
isNumber(java.lang.String str) |
void |
loadPropfile(java.io.File file) |
static java.lang.String |
myHost()
Returns the name of the localhost.
|
static java.lang.String |
printOid(AsnObjectId oid)
Prints the oid, but checks first if it is one of the usmStats
error messages.
|
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 OID
public static final java.lang.String CONTEXT_ENGINE_ID
public static final java.lang.String CONTEXT_NAME
public static final java.lang.String USERNAME
public static final java.lang.String USER_AUTH_PASSWORD
public static final java.lang.String AUTH_PROTOCOL
public static final java.lang.String PRIV_PROTOCOL
public static final java.lang.String USER_PRIV_PASSWORD
public static final java.lang.String USE_AUTHENTICATION
public static final java.lang.String USE_PRIVACY
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 void loadPropfile(java.io.File file)
public java.io.File getPropertiesFile()
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 getOid(java.lang.String def)
oid
property.def
- The default value.oid
property.OID
public java.lang.String getContextEngineIdStr()
public byte[] getContextEngineId()
public java.lang.String getContextName()
public java.lang.String getUserName()
public int getUseAuth()
public java.lang.String getUserAuthPassword()
public int getAuthProcotol()
public int getUsePriv()
public java.lang.String getUserPrivPassword()
public int getPrivProcotol()
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)
public static java.lang.String printOid(AsnObjectId oid)