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.examplev2c
Class Util

    java.lang.Object
      |
      +--uk.co.westhawk.examplev2c.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/21 10:29:37 $
Author:
  Birgit Arkesteijn

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

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

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

### COMM

    public static final java.lang.String COMM

### OID

    public static final java.lang.String OID

### INTERVAL

    public static final java.lang.String INTERVAL

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

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

### getCommunity

    public java.lang.String getCommunity()

  Returns the `comm` property. The default value will be the default community name.
  Returns:
    The `comm` property.
  See Also:
    `COMM`, `SnmpContext.Default_Community`

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

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

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