Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB Java Edition version 3.2.76
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sleepycat.je.jmx
Class JEMBeanHelper

    java.lang.Object
      com.sleepycat.je.jmx.JEMBeanHelper

    public class JEMBeanHelper

extends Object

JEMBeanHelper is a utility class for the MBean implementation which wants to add management of a JE environment to its capabilities. MBean implementations can contain a JEMBeanHelper instance to get MBean metadata for JE and to set attributes, get attributes, and invoke operations.

com.sleepycat.je.jmx.JEMonitor and the example program jmx.JEApplicationMBean are two MBean implementations which provide support different application use cases. See those classes for examples of how to use JEMBeanHelper.

Field Summary
`static String` | `ATT_CACHE_PERCENT`
`static String` | `ATT_CACHE_SIZE`
`static String` | `ATT_ENV_HOME`
`static String` | `ATT_IS_READ_ONLY`
`static String` | `ATT_IS_SERIALIZABLE`
`static String` | `ATT_IS_TRANSACTIONAL`
`static String` | `ATT_LOCK_TIMEOUT`
`static String` | `ATT_OPEN`
`static String` | `ATT_SET_READ_ONLY`
`static String` | `ATT_SET_SERIALIZABLE`
`static String` | `ATT_SET_TRANSACTIONAL`
`static String` | `ATT_TXN_TIMEOUT`

Constructor Summary
`JEMBeanHelper(File environmentHome, boolean canConfigure)` Instantiate a helper, specifying environment home and open capabilities.

Method Summary
`Object` | `getAttribute(Environment targetEnv, String attributeName)` Get an attribute value for the given environment.
`List` | `getAttributeList(Environment targetEnv)` Get MBean attribute metadata for this environment.
`File` | `getEnvironmentHome()` Return the target environment directory.
`Environment` | `getEnvironmentIfOpen()` Return an Environment only if the environment has already been opened in this process.
`EnvironmentConfig` | `getEnvironmentOpenConfig()` If the helper was instantiated with canConfigure==true, it shows environment configuration attributes.
`boolean` | `getNeedReset()` Tell the MBean if the available set of functionality has changed.
`MBeanNotificationInfo[]` | `getNotificationInfo(Environment targetEnv)` No notifications are supported.
`List` | `getOperationList(Environment targetEnv)` Get mbean operation metadata for this environment.
`Object` | `invoke(Environment targetEnv, String actionName, Object[] params, String[] signature)` Invoke an operation for the given environment.
`void` | `setAttribute(Environment targetEnv, Attribute attribute)` Set an attribute value for the given environment.

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

Field Detail

### ATT_ENV_HOME

    public static final String ATT_ENV_HOME

See Also:
  Constant Field Values

### ATT_OPEN

    public static final String ATT_OPEN

See Also:
  Constant Field Values

### ATT_IS_READ_ONLY

    public static final String ATT_IS_READ_ONLY

See Also:
  Constant Field Values

### ATT_IS_TRANSACTIONAL

    public static final String ATT_IS_TRANSACTIONAL

See Also:
  Constant Field Values

### ATT_CACHE_SIZE

    public static final String ATT_CACHE_SIZE

See Also:
  Constant Field Values

### ATT_CACHE_PERCENT

    public static final String ATT_CACHE_PERCENT

See Also:
  Constant Field Values

### ATT_LOCK_TIMEOUT

    public static final String ATT_LOCK_TIMEOUT

See Also:
  Constant Field Values

### ATT_IS_SERIALIZABLE

    public static final String ATT_IS_SERIALIZABLE

See Also:
  Constant Field Values

### ATT_TXN_TIMEOUT

    public static final String ATT_TXN_TIMEOUT

See Also:
  Constant Field Values

### ATT_SET_READ_ONLY

    public static final String ATT_SET_READ_ONLY

See Also:
  Constant Field Values

### ATT_SET_TRANSACTIONAL

    public static final String ATT_SET_TRANSACTIONAL

See Also:
  Constant Field Values

### ATT_SET_SERIALIZABLE

    public static final String ATT_SET_SERIALIZABLE

See Also:
  Constant Field Values

Constructor Detail

### JEMBeanHelper

    public JEMBeanHelper(File environmentHome,
                         boolean canConfigure)

  Instantiate a helper, specifying environment home and open capabilities.

  Parameters:
    `environmentHome` - home directory of the target JE environment.
    `canConfigure` - If true, the helper will show environment configuration attributes.

Method Detail

### getEnvironmentHome

    public File getEnvironmentHome()

  Return the target environment directory.

  Returns:
    the environment directory.

### getEnvironmentOpenConfig

    public EnvironmentConfig getEnvironmentOpenConfig()

  If the helper was instantiated with canConfigure==true, it shows environment configuration attributes. Those attributes are returned within this EnvironmentConfig object for use in opening environments.

  Returns:
    EnvironmentConfig object which saves configuration attributes recorded through MBean attributes.

### getEnvironmentIfOpen

    public Environment getEnvironmentIfOpen()

  Return an Environment only if the environment has already been opened in this process. A helper method for MBeans which want to only access open environments.

  Returns:
    Environment if already open, null if not open.

### getNeedReset

    public boolean getNeedReset()

  Tell the MBean if the available set of functionality has changed.

  Returns:
    true if the MBean should regenerate its JE metadata.

### getAttributeList

    public List getAttributeList(Environment targetEnv)

  Get MBean attribute metadata for this environment.

  Parameters:
    `targetEnv` - The target JE environment. May be null if the environment is not open.
  Returns:
    list of MBeanAttributeInfo objects describing the available attributes.

### getAttribute

    public Object getAttribute(Environment targetEnv,
                               String attributeName)
                        throws AttributeNotFoundException,
                               MBeanException

  Get an attribute value for the given environment. Check JEMBeanHelper.getNeedReset() after this call because the helper may detect that the environment has changed and that the MBean metadata should be reset.

  Parameters:
    `targetEnv` - The target JE environment. May be null if the environment is not open.
    `attributeName` - attribute name.
  Returns:
    attribute value.
  Throws:
    `AttributeNotFoundException`
    `MBeanException`

### setAttribute

    public void setAttribute(Environment targetEnv,
                             Attribute attribute)
                      throws AttributeNotFoundException,
                             InvalidAttributeValueException

  Set an attribute value for the given environment.

  Parameters:
    `targetEnv` - The target JE environment. May be null if the environment is not open.
    `attribute` - name/value pair
  Throws:
    `AttributeNotFoundException`
    `InvalidAttributeValueException`

### getOperationList

    public List getOperationList(Environment targetEnv)

  Get mbean operation metadata for this environment.

  Parameters:
    `targetEnv` - The target JE environment. May be null if the environment is not open.
  Returns:
    List of MBeanOperationInfo describing available operations.

### invoke

    public Object invoke(Environment targetEnv,
                         String actionName,
                         Object[] params,
                         String[] signature)
                  throws MBeanException

  Invoke an operation for the given environment.

  Parameters:
    `targetEnv` - The target JE environment. May be null if the environment is not open.
    `actionName` - operation name.
    `params` - operation parameters. May be null.
    `signature` - operation signature. May be null.
  Returns:
    the operation result
  Throws:
    `MBeanException`

### getNotificationInfo

    public MBeanNotificationInfo[] getNotificationInfo(Environment targetEnv)

  No notifications are supported.

  Returns:
    List of MBeanNotificationInfo for available notifications.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB Java Edition version 3.2.76
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 1996,2008 Oracle. All rights reserved.