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

    java.lang.Object
      |
      +--uk.co.westhawk.examplev1.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/09 14:19:03 $
Author:
  Birgit Arkesteijn

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

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

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

### COMM

    public static final java.lang.String COMM

See Also:
  Constant Field Values

### OID

    public static final java.lang.String OID

See Also:
  Constant Field Values

### INTERVAL

    public static final java.lang.String INTERVAL

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

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

### 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`, `SnmpContextFace.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 5_1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD