Interface PersistingResourceMBean
-
- All Known Subinterfaces:
CassandraKeyValueStoreResourceMBean
,CassandraPoolMaintenanceResourceMBean
,CassandraResourceMBean
,CassandraSessionOwnershipResourceMBean
,KeyValueStoreResourceMBean
,PoolMaintenanceResourceMBean
,SessionOwnershipResourceMBean
public interface PersistingResourceMBean
A
PersistingResourceMBean
provides 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 String
BASE_OBJECT_NAME
The base JMX Object Name of all Persisting Resource MBeans.static String
MBEAN_NAME
The name of this MBean, equal to the string "PersistingResource".static String
RESOURCE_NAME_KEY
The JMX Object Name property key that identifies the name of the resource.static String
RESOURCE_TYPE_KEY
The JMX Object Name property key that identifies the specific resource that registered the MBean.static String
RESOURCE_VARIANT_KEY
The 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 TabularData
dumpTable(String keyspaceName, String tableName, long timeout, int maxRows)
Return the content of the specified table as tabular data.String
getDataDefinitions(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.ObjectName
getObjectName(String resourceType, String resourceVariant, String resourceName)
Create anObjectName
for aPersistingResourceMBean
with 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_KEY
to 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
ObjectName
for aPersistingResourceMBean
with 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
ObjectName
for aPersistingResourceMBean
with the specified attributes. - Throws:
NullPointerException
- ifresourceType
orresourceName
arenull
.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
- ifkeyspaceName
isnull
.UnrecognizedKeyspaceException
- ifkeyspaceName
is 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 inkeyspaceNames
results in anull
value at the corresponding array index in this array, - Throws:
NullPointerException
- ifkeyspaceNames
isnull
.InvalidArgumentException
- ifkeyspaceNames
is zero-length or containsnull
elements.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
- ifkeyspaceName
is 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 of0
indicates no timeout.maxRows
- the maximum number of table rows to return. A value less than or equal to0
indicates no limit.- Returns:
- the table rows converted to tabular data. The format of the tabular data is table dependent.
- Throws:
NullPointerException
- ifkeyspaceName
ortableName
isnull
.InvalidArgumentException
- iftimeout
is less than 0.UnrecognizedKeyspaceException
- ifkeyspaceName
is not the name of a keyspace known by the resource.UnrecognizedTableNameException
- iftableName
is 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
-
-