Interface PersistingResourceMBean
-
- All Known Subinterfaces:
CassandraKeyValueStoreResourceMBean,CassandraPoolMaintenanceResourceMBean,CassandraResourceMBean,CassandraSessionOwnershipResourceMBean,KeyValueStoreResourceMBean,PoolMaintenanceResourceMBean,SessionOwnershipResourceMBean
public interface PersistingResourceMBeanA
PersistingResourceMBeanprovides access to a Rhino resource that interacts with an external database (or similar), typically for the persistence of runtime session state.- Since:
- Rhino 3.2
-
-
Field Summary
Fields Modifier and Type Field Description static StringBASE_OBJECT_NAMEThe base JMX Object Name of all Persisting Resource MBeans.static StringMBEAN_NAMEThe name of this MBean, equal to the string "PersistingResource".static StringRESOURCE_NAME_KEYThe JMX Object Name property key that identifies the name of the resource.static StringRESOURCE_TYPE_KEYThe JMX Object Name property key that identifies the specific resource that registered the MBean.static StringRESOURCE_VARIANT_KEYThe JMX Object Name property key that identifies the variant of the resource.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TabularDatadumpTable(String keyspaceName, String tableName, long timeout, int maxRows)Return the content of the specified table as tabular data.StringgetDataDefinitions(String keyspaceName)Get the data definitions for the specified database keyspace.String[]getDataDefinitions(String[] keyspaceNames)Get an array of data definitions corresponding to an array of keyspace names.String[]getKeyspaces()Get the names of the database keyspaces that the resource is using.ObjectNamegetObjectName(String resourceType, String resourceVariant, String resourceName)Create anObjectNamefor aPersistingResourceMBeanwith the specified resource type, variant, and optional name.String[]getTableNames(String keyspaceName)Get the names of the tables used by this persisting resource in the specified keyspace.
-
-
-
Field Detail
-
MBEAN_NAME
static final String MBEAN_NAME
The name of this MBean, equal to the string "PersistingResource".
- See Also:
- Constant Field Values
-
BASE_OBJECT_NAME
static final String BASE_OBJECT_NAME
The base JMX Object Name of all Persisting Resource MBeans. This string is equal to "com.opencloud.rhino:type=PersistingResource" and the string
BASE_OBJECT_NAME + ",*"defines a JMX Object Name property pattern which matches with all Persisting Resource MBeans that are registered with the MBean Server. A Persisting Resource MBean is registered with the MBean Server using this base name in conjunction with properties whose keys are specified by theand {@link #RESOURCE_VARIANT_KEY}, and optionally theRESOURCE_NAME_KEYto identify a specific instance of the resource if there can be multiple resources of the same type and variant configured. <p/> A complete Object Name can be created easily using thegetObjectName(String, String, String)method.- See Also:
- Constant Field Values
-
RESOURCE_TYPE_KEY
static final String RESOURCE_TYPE_KEY
The JMX Object Name property key that identifies the specific resource that registered the MBean. This key is always present in the ObjectName of a PersistingResourceMBean and is equal to the string "resource".
- See Also:
- Constant Field Values
-
RESOURCE_VARIANT_KEY
static final String RESOURCE_VARIANT_KEY
The JMX Object Name property key that identifies the variant of the resource. The variant refers to the type of the backing database the resource uses, e.g. Cassandra, etc. This key is always present in the ObjectName of a PersistingResourceMBean and is equal to the string "variant".
- See Also:
- Constant Field Values
-
RESOURCE_NAME_KEY
static final String RESOURCE_NAME_KEY
The JMX Object Name property key that identifies the name of the resource. This key is equal to the string "resourceName" and is only present if there can be multiple resources of a given type present in Rhino. The value assigned to this key should be quoted using
ObjectName.quote(String).- See Also:
- Constant Field Values
-
-
Method Detail
-
getObjectName
ObjectName getObjectName(String resourceType, String resourceVariant, String resourceName) throws MalformedObjectNameException
Create an
ObjectNamefor aPersistingResourceMBeanwith the specified resource type, variant, and optional name.- Parameters:
resourceType- the resource type.resourceVariant- the resource variant.resourceName- an optional name for the resource.- Returns:
- an
ObjectNamefor aPersistingResourceMBeanwith the specified attributes. - Throws:
NullPointerException- ifresourceTypeorresourceNamearenull.MalformedObjectNameException- if an error occurs trying to create the ObjectName.- Since:
- Rhino 3.2
-
getKeyspaces
String[] getKeyspaces() throws ManagementException
Get the names of the database keyspaces that the resource is using.
- Returns:
- the names of the database keyspaces.
- Throws:
ManagementException- if the operation could not be successfully completed due to a system-level failure.- Since:
- Rhino 3.2
-
getDataDefinitions
String getDataDefinitions(String keyspaceName) throws NullPointerException, UnrecognizedKeyspaceException, ManagementException
Get the data definitions for the specified database keyspace.
The format of the data definitions are resource dependent. Refer to subclasses for more detail.
- Parameters:
keyspaceName- the keyspace name. This must be one of the names returned bygetKeyspaces().- Returns:
- the keyspace data definitions.
- Throws:
NullPointerException- ifkeyspaceNameisnull.UnrecognizedKeyspaceException- ifkeyspaceNameis not the name of a keyspace known by the resource.ManagementException- if the operation could not be successfully completed due to a system-level failure.- Since:
- Rhino 3.2
-
getDataDefinitions
String[] getDataDefinitions(String[] keyspaceNames) throws NullPointerException, InvalidArgumentException, ManagementException
Get an array of data definitions corresponding to an array of keyspace names.
- Parameters:
keyspaceNames- the array of keyspace names.- Returns:
- an array of data definitions.
This array will be the same length as the supplied array, and if
dataDefinitions = getDataDefinitions(keyspaceNames)thendataDefinitions[i] == getDataDefinitions(keyspaceNames[i]). Any unrecognized keyspace name present inkeyspaceNamesresults in anullvalue at the corresponding array index in this array, - Throws:
NullPointerException- ifkeyspaceNamesisnull.InvalidArgumentException- ifkeyspaceNamesis zero-length or containsnullelements.ManagementException- if the operation could not be successfully completed due to a system-level failure.- Since:
- Rhino 3.2
-
getTableNames
String[] getTableNames(String keyspaceName) throws NullPointerException, UnrecognizedKeyspaceException, ManagementException
Get the names of the tables used by this persisting resource in the specified keyspace.
- Parameters:
keyspaceName- the keyspace name. This must be one of the names returned bygetKeyspaces().- Returns:
- an array of table names.
- Throws:
NullPointerException- if keyspaceName` isnull.UnrecognizedKeyspaceException- ifkeyspaceNameis not the name of a keyspace known by the resource.ManagementException- if the operation could not be successfully completed due to a system-level failure.- Since:
- Rhino 3.2
-
dumpTable
TabularData dumpTable(String keyspaceName, String tableName, long timeout, int maxRows) throws NullPointerException, InvalidArgumentException, UnrecognizedKeyspaceException, UnrecognizedTableNameException, TableDumpException, ManagementException
Return the content of the specified table as tabular data.
Table columns will be converted to tabular data on a "best fit" basis. Where there is a corresponding JMX open type for a database column type, such as for numeric types and strings, column values will be mapped across directly. In other cases, some conversion may occur. For example, collections and maps may be converted to a simple flat string rendering, and binary data may be converted to a string of printable characters.
- Parameters:
keyspaceName- the keyspace name. This must be one of the names returned bygetKeyspaces().tableName- the table name. This must be one of the names returned bygetTableNames(keyspaceName).timeout- the time to wait for results to be returned from the database. A timeout of0indicates no timeout.maxRows- the maximum number of table rows to return. A value less than or equal to0indicates no limit.- Returns:
- the table rows converted to tabular data. The format of the tabular data is table dependent.
- Throws:
NullPointerException- ifkeyspaceNameortableNameisnull.InvalidArgumentException- iftimeoutis less than 0.UnrecognizedKeyspaceException- ifkeyspaceNameis not the name of a keyspace known by the resource.UnrecognizedTableNameException- iftableNameis not the name of a table in the specified keyspace.TableDumpException- if a problem occurs obtaining the table data, such a no connection to the database or a read error.ManagementException- if the operation could not be successfully completed due to a system-level failure.- Since:
- Rhino 3.2
-
-