Class Index | File Index

Classes


Class Resource


Defined in: rhqapi.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Resource(param)
creates a new instance of Resource
Field Summary
Field Attributes Field Name and Description
 
enumerates metrics available for this resource, returned value is not an array but a hash, where name is metric name without spaces
 
gets resource name
Method Summary
Method Attributes Method Name and Description
 
gets alert definitions for this resource
 
checkOperation(name, opParams)
Checks that given operation with given parameters is valid on this resource.
 
child(params)
gets child resource by given params
 
children(params)
get's child resources
 
createChild(params)
creates a new child resource
 
checks whether resource exists in inventory
 
retrieves LIVE configuration of this resource
 
gets resource ID
 
getMetric(name)
gets a metric by it's name
 
gets resource name
 
retrieves plugin configuration for this resource
 
 
gets resource type id
 
invokeOperation(name, params)
invokes operation on resource, operation status is polled 'till timeout is reached or operation finishes
 
returns true if availability == UP
 
 
removes/deletes this resource from inventory.
 
scheduleOperation(name, delay, repeatInterval, repeatCount, opParams)
schedules operation on resource.
 
scheduleOperationUsingCron(name, cronExpression, opParams)
schedules operation on resource using crone expression.
 
gets resource String representation
 
unimports resource
 
update(params)
Update resource's editable properties (name, description, location).
 
updates configuration of this resource.
 
updates plugin configuration (Connection settings) of this resource.
 
wait's until resource becomes UP or timeout is reached
 
wait's until given child resource exists (useful when you need to wait for discovery)
 
wait's until resource becomes DOWN or timeout is reached
 
waitForOperationResult(resOpShedule)
Waits until operation is finished or timeout is reached.
Class Detail
Resource(param)
creates a new instance of Resource
Parameters:
param
{org.rhq.bindings.client.ResourceClientProxy|Number} proxy object or id
Field Detail
{Metric[]} metrics
enumerates metrics available for this resource, returned value is not an array but a hash, where name is metric name without spaces
resource.metrics.totalSwapSpace // get's a metric called 'Total Swap Space'

{String} name
gets resource name
Method Detail
{AlertDefinition[]} alertDefinitons(params)
gets alert definitions for this resource
Parameters:
{Object} params
- you can filter alert definitions same as in alertDefinitions.find() function
Returns:
array of alert definitions

checkOperation(name, opParams)
Checks that given operation with given parameters is valid on this resource. Default parameters are used when ommited.
Parameters:
{String} name
of operation (required)
{Object} opParams
- hashmap for operation params (Configuration) (optional)
Returns:
checked configuration

{Resource} child(params)
gets child resource by given params
Parameters:
{Object} params
- you can filter child resources same way as in resources.find() function
Returns:
first matching child resource found

{Resource[]} children(params)
get's child resources
Parameters:
{Object} params
- you can filter child resources same way as in resources.find() function
Returns:
array of child resources

{Resource} createChild(params)
creates a new child resource
// create a deployment child on JBoss AS7
as.createChild({name:"hello.war",type:"Deployment",content:"/tmp/hello.war"});
// create a network interface with configuration on JBoss AS7
as.createChild({name:"testinterface",type:"Network Interface",config:{"inet-address":"127.0.0.1","any-address":false}});
Parameters:
{Object} params
can contain following: -
  • name [String] (required)- name for a new resource child, name is optional when `content` is provided
  • type [String] (required) - resource type name to be created (exact name, not just filter)
  • config [Object] (optional) - configuration map for new resource, if not present, default is taken
  • pluginConfig [Object] (optional) - plugin configuration for new resource, if not present, default is taken (NOT YET IMPLEMENTED)
  • content [String] (optional) - absolute path for resource's content file (typical for deployments)
  • version [String] (optional) - version string
Returns:
new resource if it was successfully created and discovered, null otherwise

{Boolean} exists()
checks whether resource exists in inventory
Returns:
bool

{Object} getConfiguration()
retrieves LIVE configuration of this resource
Returns:
live configuration or null if it is not available (ressource is DOWN or UNKNOWN)

{Number} getId()
gets resource ID

{Metric} getMetric(name)
gets a metric by it's name
resource.getMetric("Total Swap Space")
Parameters:
name

{String} getName()
gets resource name

{Object} getPluginConfiguration()
retrieves plugin configuration for this resource
Returns:
plugin configuration object (Connection settings)

getProxy()
Returns:
Resource proxy object

{Number} getResourceTypeId()
gets resource type id

invokeOperation(name, params)
invokes operation on resource, operation status is polled 'till timeout is reached or operation finishes
Parameters:
{String} name
of operation (required)
{Object} params
- hashmap for operation params (Configuration) (optional)
Returns:
javascript object (hashmap) with following keys:
  • status {String} - operation status
  • error {String} - operation error message
  • result {Object} - result configuration

    {Boolean} isAvailable()
    returns true if availability == UP

    {Resource} parent()
    Returns:
    parent resource

    {Boolean} remove()
    removes/deletes this resource from inventory.
    Returns:
    true if resource no longer exists in inventory, false otherwise

    scheduleOperation(name, delay, repeatInterval, repeatCount, opParams)
    schedules operation on resource. In contrast to invokeOperation this is not blocking (synchronous) operation.
    Parameters:
    {String} name
    of operation (required)
    {long} delay
    delay in seconds (required)
    {long} repeatInterval
    repeatInterval in seconds (required)
    {int} repeatCount
    repeatCount in seconds (required)
    {Object} opParams
    - hashmap for operation params (Configuration) (optional)

    scheduleOperationUsingCron(name, cronExpression, opParams)
    schedules operation on resource using crone expression. In contrast to invokeOperation this is not blocking (synchronous) operation.
    Parameters:
    {String} name
    of operation (required)
    {String} cronExpression
    (required)
    {Object} opParams
    - hashmap for operation params (Configuration) (optional)

    {String} toString()
    gets resource String representation

    {Boolean} uninventory()
    unimports resource
    Returns:
    true if resource is dos no longer exist in inventory, false otherwise

    {Resource} update(params)
    Update resource's editable properties (name, description, location).
    new Resource(12345).update({name:"new name",description:"new description",location:"new location"})
    Parameters:
    params
    Returns:
    updated Resource

    {Boolean} updateConfiguration(params)
    updates configuration of this resource. You can either pass whole configuration (retrieved by Resource.getConfiguration()) or only params that needs to be changed
    // to switch agent resource to ssl socket
    agent.updateConfiguration({'rhq.communications.connector.transport':'sslsocket'});
    Parameters:
    {Object} params
    - new configuration parameters, partial configuration is supported
    Returns:
    True if configuration was updated

    {Boolean} updatePluginConfiguration(params)
    updates plugin configuration (Connection settings) of this resource. You can either pass whole configuration (retrieved by Resource.getPluginConfiguration()) or only params that needs to be changed
    // set new start script arguments for as7
    as7.updatePluginConfiguration({'startScriptArgs':'-Djboss.server.base.dir=foo'});
    Parameters:
    {Object} params
    - new configuration parameters, partial configuration is supported
    Returns:
    True if configuration was updated

    {Boolean} waitForAvailable()
    wait's until resource becomes UP or timeout is reached
    Returns:
    true if resource became or is available, false otherwise

    {Resource} waitForChild(-)
    wait's until given child resource exists (useful when you need to wait for discovery)
    Parameters:
    {Object} -
    you can filter child resources same way as in resources.find() function
    Returns:
    first matchin child resource found

    {Boolean} waitForNotAvailable()
    wait's until resource becomes DOWN or timeout is reached
    Returns:
    true if resource became or is DOWN, false otherwise

    waitForOperationResult(resOpShedule)
    Waits until operation is finished or timeout is reached.
    Parameters:
    resOpShedule
    may be null, than the most recent job for this resource is picked
    Returns:
    operation history

    Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jan 06 2014 16:48:32 GMT+0100 (CET)