Overview | Package | Class | Tree | Deprecated | Index | Help
| SNMP Stack 4_12
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | 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.1 $ $Date: 2002/10/22 10:49:42 $
Author:
  Birgit Arkesteijn

Field Summary
`static java.lang.String` | `AUTH_PROTOCOL`
`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()`
`byte[]` | `getContextEngineId()`
`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

### PORT

    public static final java.lang.String PORT

### SOCKETTYPE

    public static final java.lang.String SOCKETTYPE

### OID

    public static final java.lang.String OID

### CONTEXT_ENGINE_ID

    public static final java.lang.String CONTEXT_ENGINE_ID

### CONTEXT_NAME

    public static final java.lang.String CONTEXT_NAME

### USERNAME

    public static final java.lang.String USERNAME

### USER_AUTH_PASSWORD

    public static final java.lang.String USER_AUTH_PASSWORD

### AUTH_PROTOCOL

    public static final java.lang.String AUTH_PROTOCOL

### USER_PRIV_PASSWORD

    public static final java.lang.String USER_PRIV_PASSWORD

### USE_AUTHENTICATION

    public static final java.lang.String USE_AUTHENTICATION

### USE_PRIVACY

    public static final java.lang.String USE_PRIVACY

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`

### 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`

### 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 4_12
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD