Overview | Package | Class | Tree | Deprecated | Index | Help
| SNMP Stack 5_1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uk.co.westhawk.examplev3
Class Util

    java.lang.Object
      |
      +--uk.co.westhawk.examplev3.Util

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.

Version:
  $Revision: 1.5 $ $Date: 2006/02/08 12:23:57 $
Author:
  Birgit Arkesteijn

Field Summary
`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` | `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 Summary
`Util(java.lang.String propertiesFilename, java.lang.String classname)` Constructor.

Method Summary
`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.
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### HOST

    public static final java.lang.String HOST

See Also:
  Constant Field Values

### BIND

    public static final java.lang.String BIND

See Also:
  Constant Field Values

### PORT

    public static final java.lang.String PORT

See Also:
  Constant Field Values

### SOCKETTYPE

    public static final java.lang.String SOCKETTYPE

See Also:
  Constant Field Values

### OID

    public static final java.lang.String OID

See Also:
  Constant Field Values

### CONTEXT_ENGINE_ID

    public static final java.lang.String CONTEXT_ENGINE_ID

See Also:
  Constant Field Values

### CONTEXT_NAME

    public static final java.lang.String CONTEXT_NAME

See Also:
  Constant Field Values

### USERNAME

    public static final java.lang.String USERNAME

See Also:
  Constant Field Values

### USER_AUTH_PASSWORD

    public static final java.lang.String USER_AUTH_PASSWORD

See Also:
  Constant Field Values

### AUTH_PROTOCOL

    public static final java.lang.String AUTH_PROTOCOL

See Also:
  Constant Field Values

### USER_PRIV_PASSWORD

    public static final java.lang.String USER_PRIV_PASSWORD

See Also:
  Constant Field Values

### USE_AUTHENTICATION

    public static final java.lang.String USE_AUTHENTICATION

See Also:
  Constant Field Values

### USE_PRIVACY

    public static final java.lang.String USE_PRIVACY

See Also:
  Constant Field Values

Constructor Detail

### Util

    public Util(java.lang.String propertiesFilename,
                java.lang.String classname)

  Constructor. The name of the properties file can be passed as parameter. If the filename is null, it will look for a properties file, based on `<classname>.properties`.

Parameters:
  `propertiesFilename` - The name of the properties file. Can be null.
  `classname` - The full name of the class using this class.

Method Detail

### loadPropfile

    public void loadPropfile(java.io.File file)

### getPropertiesFile

    public java.io.File getPropertiesFile()

### getDefaultPropertiesFilename

    public static java.lang.String getDefaultPropertiesFilename(java.lang.String classname)

### myHost

    public static java.lang.String myHost()

  Returns the name of the localhost. If that cannot be found it will return `localhost`.

  Returns:
    my host

### getHost

    public java.lang.String getHost()

  Returns the `host` property.

  Returns:
    The `host` property.
  See Also:
    `HOST`

### getBindAddress

    public java.lang.String getBindAddress()

  Returns the `bind` property.

  Returns:
    The `bind` property.
  Since:
    4_14
  See Also:
    `BIND`

### getPort

    public java.lang.String getPort()

  Returns the `port` property.

  Returns:
    The `port` property.
  See Also:
    `PORT`

### getPort

    public int getPort(int def)

  Returns the `port` property.

  Parameters:
    `def` - The default value.
  Returns:
    The `port` property.
  See Also:
    `PORT`

### getSocketType

    public java.lang.String getSocketType()

  Returns the `sockettype` property. The default value will be the standard socket.

  Returns:
    The `sockettype` property.
  See Also:
    `SOCKETTYPE`, `SnmpContextBasisFace.STANDARD_SOCKET`

### getOid

    public java.lang.String getOid(java.lang.String def)

  Returns the `oid` property.

  Parameters:
    `def` - The default value.
  Returns:
    The `oid` property.
  See Also:
    `OID`

### getContextEngineIdStr

    public java.lang.String getContextEngineIdStr()

### getContextEngineId

    public byte[] getContextEngineId()

### getContextName

    public java.lang.String getContextName()

### getUserName

    public java.lang.String getUserName()

### getUseAuth

    public int getUseAuth()

### getUserAuthPassword

    public java.lang.String getUserAuthPassword()

### getAuthProcotol

    public int getAuthProcotol()

### getUsePriv

    public int getUsePriv()

### getUserPrivPassword

    public java.lang.String getUserPrivPassword()

### getProperty

    public java.lang.String getProperty(java.lang.String key)

### getProperty

    public java.lang.String getProperty(java.lang.String key,
                                        java.lang.String defaultValue)

### getIntParameter

    public int getIntParameter(java.lang.String key,
                               int def)

  Return the integer value of a property. If there is no property `key`, or the value is not an integer, the default value is returned.

  Parameters:
    `key` - The key
    `def` - The default value

### isNumber

    public static boolean isNumber(java.lang.String str)

### getNumber

    public static int getNumber(java.lang.String str)

### printOid

    public static java.lang.String printOid(AsnObjectId oid)

  Prints the oid, but checks first if it is one of the usmStats error messages. If so, it translates it to the usmStats string.

Overview | Package | Class | Tree | Deprecated | Index | Help
| SNMP Stack 5_1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD