org.rhq.enterprise.server.measurement
Interface MeasurementScheduleManagerLocal

All Known Implementing Classes:
MeasurementScheduleManagerBean

public interface MeasurementScheduleManagerLocal

A manager for MeasurementSchedules.

Author:
Heiko W. Rupp

Method Summary
 void createSchedulesForExistingResources(org.rhq.core.domain.resource.ResourceType type, org.rhq.core.domain.measurement.MeasurementDefinition newDefinition)
          Create MeasurementSchedules for existing resources hanging on newType.
 void disableAllDefaultCollections(org.rhq.core.domain.auth.Subject subject)
          Disables all collection schedules for all measurement definitions.
 void disableAllSchedules(org.rhq.core.domain.auth.Subject subject)
          Disables all collection schedules attached to all resources.
 void disableDefaultCollectionForMeasurementDefinitions(org.rhq.core.domain.auth.Subject subject, int[] measurementDefinitionIds, boolean updateSchedules)
          Disables all collection schedules in the given measurement definition IDs.
 void disableMeasurementTemplates(org.rhq.core.domain.auth.Subject subject, int[] measurementDefinitionIds)
           
 void disableSchedulesForAutoGroup(org.rhq.core.domain.auth.Subject subject, int parentResourceId, int childResourceType, int[] measurementDefinitionIds)
          Disable the measurement schedules for the passed definitions of the rsource ot the passed auto group.
 void disableSchedulesForCompatibleGroup(org.rhq.core.domain.auth.Subject subject, int groupId, int[] measurementDefinitionIds)
          Disable the measurement schedules for the passed definitions for the resources of the passed compatible group.
 int disableSchedulesForContext(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.common.EntityContext context, int[] measurementDefinitionIds)
           
 void disableSchedulesForResource(org.rhq.core.domain.auth.Subject subject, int resourceId, int[] measurementDefinitionIds)
          Disables all collection schedules attached to the given resource whose schedules are based off the given definitions.
 void enableMeasurementTemplates(org.rhq.core.domain.auth.Subject subject, int[] measurementDefinitionIds)
           
 void enableSchedulesForAutoGroup(org.rhq.core.domain.auth.Subject subject, int parentResourceId, int childResourceType, int[] measurementDefinitionIds)
          Enable the measurement schedules for the passed definitions of the resource ot the passed auto group.
 void enableSchedulesForCompatibleGroup(org.rhq.core.domain.auth.Subject subject, int groupId, int[] measurementDefinitionIds)
          Enable the measurement schedules for the passed definitions for the resources of the passed compatible group.
 int enableSchedulesForContext(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.common.EntityContext context, int[] measurementDefinitionIds)
           
 void enableSchedulesForResource(org.rhq.core.domain.auth.Subject subject, int resourceId, int[] measurementDefinitionIds)
          Enable the schedules for the provided definitions and resource
 void errorCorrectSchedules()
          This method should be called when it is determined that the data in the measurement schedule table might be corrupt.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.measurement.MeasurementSchedule> findSchedulesByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.MeasurementScheduleCriteria criteria)
          TODO
 List<org.rhq.core.domain.measurement.MeasurementSchedule> findSchedulesByIds(int[] ids)
          Return a list of MeasurementSchedules for the given ids
 List<org.rhq.core.domain.measurement.MeasurementSchedule> findSchedulesByResourceIdAndDefinitionIds(org.rhq.core.domain.auth.Subject subject, int resourceId, int[] definitionIds)
          Return a list of MeasurementSchedules for the given definition ids and resource id.
 List<org.rhq.core.domain.measurement.MeasurementSchedule> findSchedulesByResourceIdsAndDefinitionId(org.rhq.core.domain.auth.Subject subject, int[] resourceIds, int definitionId)
          Find MeasurementSchedules that are attached to a certain definition and some resources
 List<org.rhq.core.domain.measurement.MeasurementSchedule> findSchedulesByResourceIdsAndDefinitionIds(int[] resourceIds, int[] definitionIds)
          Return a list of MeasurementSchedules for the given definition ids and resource ids.
 Set<org.rhq.core.domain.measurement.ResourceMeasurementScheduleRequest> findSchedulesForResourceAndItsDescendants(int[] resourceIds, boolean getDescendents)
          Given a resource ID, this will return all schedule collections for all of the resource's measurements, including all measurements for the resource's children.
 List<org.rhq.core.domain.measurement.MeasurementSchedule> findSchedulesForResourceAndType(org.rhq.core.domain.auth.Subject subject, int resourceId, org.rhq.core.domain.measurement.DataType dataType, org.rhq.core.domain.measurement.DisplayType displayType, boolean enabledOnly)
          Determine the Schedules for a Resource and DataType.
 AgentClient getAgentClientForSchedule(org.rhq.core.domain.measurement.MeasurementSchedule sched)
          Get the AgentClient (the connection to the agent) that is associated with the given schedule.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.measurement.composite.MeasurementScheduleComposite> getMeasurementScheduleCompositesByContext(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.common.EntityContext context, org.rhq.core.domain.util.PageControl pc)
           
 org.rhq.core.domain.measurement.MeasurementSchedule getSchedule(org.rhq.core.domain.auth.Subject subject, int resourceId, int definitionId, boolean attachBaseline)
          Find MeasurementSchedules that are attached to a certain definition and a resource
 org.rhq.core.domain.measurement.MeasurementSchedule getScheduleById(org.rhq.core.domain.auth.Subject subject, int scheduleId)
          Obtain a MeasurementSchedule by its Id after a check for a valid session
 int getScheduledMeasurementsPerMinute()
           
 int insertSchedulesFor(int[] batchIds)
           
 void notifyAgentsOfScheduleUpdates(org.rhq.core.domain.common.EntityContext entityContext, String scheduleSubQuery)
          Notifies all agents of measurement schedule changes.
 int returnSchedulesFor(int[] batchIds, Set<org.rhq.core.domain.measurement.ResourceMeasurementScheduleRequest> allSchedules)
           
 void updateDefaultCollectionIntervalAndEnablementForMeasurementDefinitions(org.rhq.core.domain.auth.Subject subject, int[] measurementDefinitionIds, long collectionInterval, boolean enable, boolean updateExistingSchedules)
          Using this method one can both update the default collection interval AND enable or disable the measurement definitions.
 void updateDefaultCollectionIntervalForMeasurementDefinitions(org.rhq.core.domain.auth.Subject subject, int[] measurementDefinitionIds, long collectionInterval, boolean updateExistingSchedules)
          (Re-)Enables all collection schedules in the given measurement definition IDs and sets their collection intervals.
 void updateMeasurementTemplates(org.rhq.core.domain.auth.Subject subject, int[] measurementDefinitionIds, long collectionInterval)
          Update default measurement schedules ("metric templates").
 void updateSchedule(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.measurement.MeasurementSchedule schedule)
          Reattach a Schedule to a PersitenceContext after a successful check for a valid session
 void updateSchedulesForAutoGroup(org.rhq.core.domain.auth.Subject subject, int parentResourceId, int childResourceType, int[] measurementDefinitionIds, long collectionInterval)
          Enables all collection schedules attached to the given auto group whose schedules are based off the given definitions.
 void updateSchedulesForCompatibleGroup(org.rhq.core.domain.auth.Subject subject, int groupId, int[] measurementDefinitionIds, long collectionInterval)
          Enables all collection schedules attached to the given compatible group whose schedules are based off the given definitions.
 int updateSchedulesForContext(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.common.EntityContext context, int[] measurementDefinitionIds, long collectionInterval)
           
 void updateSchedulesForResource(org.rhq.core.domain.auth.Subject subject, int resourceId, int[] measurementDefinitionIds, long collectionInterval)
          Enables all collection schedules attached to the given resource whose schedules are based off the given definitions.
 

Method Detail

findSchedulesForResourceAndItsDescendants

Set<org.rhq.core.domain.measurement.ResourceMeasurementScheduleRequest> findSchedulesForResourceAndItsDescendants(int[] resourceIds,
                                                                                                                  boolean getDescendents)
Given a resource ID, this will return all schedule collections for all of the resource's measurements, including all measurements for the resource's children. This will also create schedules for resources if they do not already exist.

Parameters:
resourceIds - IDs of the resources whose measurements are to be returned
getDescendents - if true, descendents will be loaded as well
Returns:
the set of resource schedule requests for a subtree or a single resource

getAgentClientForSchedule

AgentClient getAgentClientForSchedule(org.rhq.core.domain.measurement.MeasurementSchedule sched)
Get the AgentClient (the connection to the agent) that is associated with the given schedule.

Parameters:
sched - a MeasurementSchedule for which we need a connection to the Agent
Returns:
an AgentClient that can be used to communicate with the Agent

findSchedulesByResourceIdAndDefinitionIds

List<org.rhq.core.domain.measurement.MeasurementSchedule> findSchedulesByResourceIdAndDefinitionIds(org.rhq.core.domain.auth.Subject subject,
                                                                                                    int resourceId,
                                                                                                    int[] definitionIds)
Return a list of MeasurementSchedules for the given definition ids and resource id.

Parameters:
definitionIds -
resourceId -
Returns:
a list of Schedules

getScheduleById

org.rhq.core.domain.measurement.MeasurementSchedule getScheduleById(org.rhq.core.domain.auth.Subject subject,
                                                                    int scheduleId)
Obtain a MeasurementSchedule by its Id after a check for a valid session

Parameters:
subject - a session id that must be valid
scheduleId - The primary key of the Schedule
Returns:
a MeasurementSchedule or null if the session or the scheduleId are invalid

getSchedule

org.rhq.core.domain.measurement.MeasurementSchedule getSchedule(org.rhq.core.domain.auth.Subject subject,
                                                                int resourceId,
                                                                int definitionId,
                                                                boolean attachBaseline)
                                                                throws MeasurementNotFoundException
Find MeasurementSchedules that are attached to a certain definition and a resource

Parameters:
subject -
definitionId - The primary key of a MeasurementDefinition
resourceId - the id of the resource
attachBaseline - TODO
Returns:
the MeasurementSchedule of the given definition for the given resource
Throws:
MeasurementNotFoundException

disableDefaultCollectionForMeasurementDefinitions

void disableDefaultCollectionForMeasurementDefinitions(org.rhq.core.domain.auth.Subject subject,
                                                       int[] measurementDefinitionIds,
                                                       boolean updateSchedules)
Disables all collection schedules in the given measurement definition IDs. This only disables the "templates", it does not disable actual schedules. For that capability, see #disableSchedules(Subject, int[], int).

Parameters:
subject -
measurementDefinitionIds -
updateSchedules - TODO

disableAllDefaultCollections

void disableAllDefaultCollections(org.rhq.core.domain.auth.Subject subject)
Disables all collection schedules for all measurement definitions. This only disables the "templates", it does not disable actual schedules. For that capability, see #disableAllMeasurementSchedules(Subject).

This is a highly disruptive method - it turns off monitoring for future resources. The user making this call must have global inventory and setting permissions to execute this.

Parameters:
subject - user that must have global inventory and setting rights

disableAllSchedules

void disableAllSchedules(org.rhq.core.domain.auth.Subject subject)
Disables all collection schedules attached to all resources. This only disables the currently existing schedules, it does not disable the templates for future resources. For that capability, see disableAllDefaultCollections(Subject).

This is a highly disruptive method - it turns off monitoring for existing resources. The user making this call must have global inventory and setting permissions to execute this.

Parameters:
subject - user that must have global inventory and setting rights

updateDefaultCollectionIntervalForMeasurementDefinitions

void updateDefaultCollectionIntervalForMeasurementDefinitions(org.rhq.core.domain.auth.Subject subject,
                                                              int[] measurementDefinitionIds,
                                                              long collectionInterval,
                                                              boolean updateExistingSchedules)
(Re-)Enables all collection schedules in the given measurement definition IDs and sets their collection intervals. This only enables the "templates", it does not enable actual schedules unless updateExistingSchedules is set to true.

Parameters:
subject - a valid subject that has the MANAGE_SETTINGS global permission
measurementDefinitionIds - the primary keys for the definitions
collectionInterval - if > 0, enable the metric with this value as the the new collection interval, in milliseconds; if == 0, enable the metric with its current collection interval; if < 0, disable the metric; if >0, the value should also be >=30000, since 30s is the minimum allowed interval; if it is not, 30000 will be used instead of the specified interval
updateExistingSchedules - if true, then existing schedules for this definition will also be updated.

updateDefaultCollectionIntervalAndEnablementForMeasurementDefinitions

void updateDefaultCollectionIntervalAndEnablementForMeasurementDefinitions(org.rhq.core.domain.auth.Subject subject,
                                                                           int[] measurementDefinitionIds,
                                                                           long collectionInterval,
                                                                           boolean enable,
                                                                           boolean updateExistingSchedules)
Using this method one can both update the default collection interval AND enable or disable the measurement definitions. This method is therefore preferable if you need to do both these things in 1 go.

Parameters:
subject - the current user
measurementDefinitionIds - the ids of measurement definitions to update
collectionInterval - the default collection interval to set
enable - whether to enable or disable the measurement definition
updateExistingSchedules - whether to accordingly update the existing schedules

updateSchedulesForAutoGroup

void updateSchedulesForAutoGroup(org.rhq.core.domain.auth.Subject subject,
                                 int parentResourceId,
                                 int childResourceType,
                                 int[] measurementDefinitionIds,
                                 long collectionInterval)
Enables all collection schedules attached to the given auto group whose schedules are based off the given definitions. This does not enable the "templates" (aka definitions). If the passed group does not exist an Exception is thrown.

Parameters:
subject - Subject of the caller
measurementDefinitionIds - the definitions on which the schedules to update are based
parentResourceId - the Id of the parent resource
childResourceType - the ID of the ResourceType of the children that form the autogroup
collectionInterval - the new interval

findSchedulesForResourceAndType

List<org.rhq.core.domain.measurement.MeasurementSchedule> findSchedulesForResourceAndType(org.rhq.core.domain.auth.Subject subject,
                                                                                          int resourceId,
                                                                                          org.rhq.core.domain.measurement.DataType dataType,
                                                                                          org.rhq.core.domain.measurement.DisplayType displayType,
                                                                                          boolean enabledOnly)
Determine the Schedules for a Resource and DataType. The data type is used to filter out (numerical) measurement and / or traits. If it is null, then we don't filter by DataType

Parameters:
subject - Subject of the caller
resourceId - PK of the resource we're interested in
dataType - DataType of the desired results use null for no filtering
displayType - the display type desired or null for no filtering
enabledOnly - should we restrict the query to certain enablement state? null means "don't care".
Returns:
List of MeasuremenSchedules for the given resource

getScheduledMeasurementsPerMinute

int getScheduledMeasurementsPerMinute()
Returns:
a rounded count of the average number of metrics that are scheduled per minute

disableSchedulesForAutoGroup

void disableSchedulesForAutoGroup(org.rhq.core.domain.auth.Subject subject,
                                  int parentResourceId,
                                  int childResourceType,
                                  int[] measurementDefinitionIds)
Disable the measurement schedules for the passed definitions of the rsource ot the passed auto group.

Parameters:
subject -
measurementDefinitionIds -
parentResourceId -
childResourceType -

enableSchedulesForAutoGroup

void enableSchedulesForAutoGroup(org.rhq.core.domain.auth.Subject subject,
                                 int parentResourceId,
                                 int childResourceType,
                                 int[] measurementDefinitionIds)
Enable the measurement schedules for the passed definitions of the resource ot the passed auto group.

Parameters:
subject -
measurementDefinitionIds -
parentResourceId -
childResourceType -

createSchedulesForExistingResources

void createSchedulesForExistingResources(org.rhq.core.domain.resource.ResourceType type,
                                         org.rhq.core.domain.measurement.MeasurementDefinition newDefinition)
Create MeasurementSchedules for existing resources hanging on newType.

Parameters:
type - The ResourceType for which we want to add schedules
newDefinition - The MeasurementDefinition where we derive the schedules from

insertSchedulesFor

int insertSchedulesFor(int[] batchIds)
                       throws Exception
Throws:
Exception

returnSchedulesFor

int returnSchedulesFor(int[] batchIds,
                       Set<org.rhq.core.domain.measurement.ResourceMeasurementScheduleRequest> allSchedules)
                       throws Exception
Throws:
Exception

errorCorrectSchedules

void errorCorrectSchedules()
This method should be called when it is determined that the data in the measurement schedule table might be corrupt. This happens when the schedules get a collection interval of less than 30 seconds. Execution of this method will automatically correct that situation, and update the mtime's of the corresponding resources whose schedules were corrupt, to cause the agent to synchronize those schedules.


findSchedulesByIds

List<org.rhq.core.domain.measurement.MeasurementSchedule> findSchedulesByIds(int[] ids)
Return a list of MeasurementSchedules for the given ids

Parameters:
ids - PrimaryKeys of the schedules searched
Returns:
a list of Schedules

findSchedulesByResourceIdsAndDefinitionId

List<org.rhq.core.domain.measurement.MeasurementSchedule> findSchedulesByResourceIdsAndDefinitionId(org.rhq.core.domain.auth.Subject subject,
                                                                                                    int[] resourceIds,
                                                                                                    int definitionId)
Find MeasurementSchedules that are attached to a certain definition and some resources

Parameters:
subject - A session id that must be valid
definitionId - The primary key of a MeasurementDefinition
resourceIds - primary of Resources wanted
Returns:
a List of MeasurementSchedules

findSchedulesByResourceIdsAndDefinitionIds

List<org.rhq.core.domain.measurement.MeasurementSchedule> findSchedulesByResourceIdsAndDefinitionIds(int[] resourceIds,
                                                                                                     int[] definitionIds)
Return a list of MeasurementSchedules for the given definition ids and resource ids. Note that this method does not take a Subject argument. Security checks are the responsibility of the caller.

Parameters:
resourceIds - The ids of the resource for which schedules are being fetched
definitionIds - The ids of the the measurement definitions
Returns:
A list of MeasurementSchedules

getMeasurementScheduleCompositesByContext

org.rhq.core.domain.util.PageList<org.rhq.core.domain.measurement.composite.MeasurementScheduleComposite> getMeasurementScheduleCompositesByContext(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                                    org.rhq.core.domain.common.EntityContext context,
                                                                                                                                                    org.rhq.core.domain.util.PageControl pc)

updateSchedulesForContext

int updateSchedulesForContext(org.rhq.core.domain.auth.Subject subject,
                              org.rhq.core.domain.common.EntityContext context,
                              int[] measurementDefinitionIds,
                              long collectionInterval)

enableSchedulesForContext

int enableSchedulesForContext(org.rhq.core.domain.auth.Subject subject,
                              org.rhq.core.domain.common.EntityContext context,
                              int[] measurementDefinitionIds)

disableSchedulesForContext

int disableSchedulesForContext(org.rhq.core.domain.auth.Subject subject,
                               org.rhq.core.domain.common.EntityContext context,
                               int[] measurementDefinitionIds)

disableSchedulesForResource

void disableSchedulesForResource(org.rhq.core.domain.auth.Subject subject,
                                 int resourceId,
                                 int[] measurementDefinitionIds)
Disables all collection schedules attached to the given resource whose schedules are based off the given definitions. This does not disable the "templates" (aka definitions).

Parameters:
subject -
measurementDefinitionIds -
resourceId -

disableSchedulesForCompatibleGroup

void disableSchedulesForCompatibleGroup(org.rhq.core.domain.auth.Subject subject,
                                        int groupId,
                                        int[] measurementDefinitionIds)
Disable the measurement schedules for the passed definitions for the resources of the passed compatible group.


disableMeasurementTemplates

void disableMeasurementTemplates(org.rhq.core.domain.auth.Subject subject,
                                 int[] measurementDefinitionIds)

enableSchedulesForResource

void enableSchedulesForResource(org.rhq.core.domain.auth.Subject subject,
                                int resourceId,
                                int[] measurementDefinitionIds)
Enable the schedules for the provided definitions and resource

Parameters:
subject -
measurementDefinitionIds -
resourceId -

enableSchedulesForCompatibleGroup

void enableSchedulesForCompatibleGroup(org.rhq.core.domain.auth.Subject subject,
                                       int groupId,
                                       int[] measurementDefinitionIds)
Enable the measurement schedules for the passed definitions for the resources of the passed compatible group.


enableMeasurementTemplates

void enableMeasurementTemplates(org.rhq.core.domain.auth.Subject subject,
                                int[] measurementDefinitionIds)

updateSchedule

void updateSchedule(org.rhq.core.domain.auth.Subject subject,
                    org.rhq.core.domain.measurement.MeasurementSchedule schedule)
Reattach a Schedule to a PersitenceContext after a successful check for a valid session

Parameters:
subject - A session id that must be valid
schedule - A MeasurementSchedule to persist.

updateSchedulesForResource

void updateSchedulesForResource(org.rhq.core.domain.auth.Subject subject,
                                int resourceId,
                                int[] measurementDefinitionIds,
                                long collectionInterval)
Enables all collection schedules attached to the given resource whose schedules are based off the given definitions. This does not enable the "templates" (aka definitions).

Parameters:
subject -
measurementDefinitionIds -
resourceId -
collectionInterval -

updateSchedulesForCompatibleGroup

void updateSchedulesForCompatibleGroup(org.rhq.core.domain.auth.Subject subject,
                                       int groupId,
                                       int[] measurementDefinitionIds,
                                       long collectionInterval)
Enables all collection schedules attached to the given compatible group whose schedules are based off the given definitions. This does not enable the "templates" (aka definitions). If the passed group is not compatible or does not exist an Exception is thrown.

Parameters:
subject - Subject of the caller
measurementDefinitionIds - the definitions on which the schedules to update are based
groupId - ID of the group
collectionInterval - the new interval

updateMeasurementTemplates

void updateMeasurementTemplates(org.rhq.core.domain.auth.Subject subject,
                                int[] measurementDefinitionIds,
                                long collectionInterval)
Update default measurement schedules ("metric templates").

Parameters:
subject - Subject of the caller
measurementDefinitionIds - the definitions on which the default schedules to update are based
collectionInterval - the new interval

findSchedulesByCriteria

org.rhq.core.domain.util.PageList<org.rhq.core.domain.measurement.MeasurementSchedule> findSchedulesByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                               org.rhq.core.domain.criteria.MeasurementScheduleCriteria criteria)
TODO

Parameters:
subject -
criteria -
Returns:

notifyAgentsOfScheduleUpdates

void notifyAgentsOfScheduleUpdates(org.rhq.core.domain.common.EntityContext entityContext,
                                   String scheduleSubQuery)
Notifies all agents of measurement schedule changes.

Parameters:
entityContext - the context.
scheduleSubQuery - the subquery indicating which schedules changed


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.