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(ResourceType type, MeasurementDefinition newDefinition)
          Create MeasurementSchedules for existing resources hanging on newType.
 void disableAllDefaultCollections(Subject subject)
          Disables all collection schedules for all measurement definitions.
 void disableAllSchedules(Subject subject)
          Disables all collection schedules attached to all resources.
 void disableDefaultCollectionForMeasurementDefinitions(Subject subject, int[] measurementDefinitionIds, boolean updateSchedules)
          Disables all collection schedules in the given measurement definition IDs.
 void disableMeasurementTemplates(Subject subject, int[] measurementDefinitionIds)
           
 void disableSchedulesForAutoGroup(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(Subject subject, int groupId, int[] measurementDefinitionIds)
          Disable the measurement schedules for the passed definitions for the resources of the passed compatible group.
 void disableSchedulesForResource(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(Subject subject, int[] measurementDefinitionIds)
           
 void enableSchedulesForAutoGroup(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(Subject subject, int groupId, int[] measurementDefinitionIds)
          Enable the measurement schedules for the passed definitions for the resources of the passed compatible group.
 void enableSchedulesForResource(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.
 PageList<MeasurementScheduleComposite> findScheduleCompositesForResource(Subject subject, int resourceId, DataType dataType, PageControl pageControl)
          Retrieves the metric collection schedules for the given resource.
 PageList<MeasurementSchedule> findSchedulesByCriteria(Subject subject, MeasurementScheduleCriteria criteria)
           
 java.util.List<MeasurementSchedule> findSchedulesByIds(int[] ids)
          Return a list of MeasurementSchedules for the given ids
 java.util.List<MeasurementSchedule> findSchedulesByResourceIdAndDefinitionIds(Subject subject, int resourceId, int[] definitionIds)
          Return a list of MeasurementSchedules for the given definition ids and resource id.
 java.util.List<MeasurementSchedule> findSchedulesByResourceIdsAndDefinitionId(Subject subject, int[] resourceIds, int definitionId)
          Find MeasurementSchedules that are attached to a certain definition and some resources
 PageList<MeasurementScheduleComposite> findSchedulesForAutoGroup(Subject subject, int parentId, int childType, PageControl pageControl)
          Get the MeasurementSchedule composites for an autogroup
 PageList<MeasurementScheduleComposite> findSchedulesForCompatibleGroup(Subject subject, int groupId, PageControl pageControl)
           
 PageList<MeasurementScheduleComposite> findSchedulesForResource(Subject subject, int resourceId, PageControl pageControl)
          Retrieves the metric collection schedules for the given resource.
 java.util.Set<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.
 java.util.List<MeasurementSchedule> findSchedulesForResourceAndType(Subject subject, int resourceId, DataType dataType, DisplayType displayType, boolean enabledOnly)
          Determine the Schedules for a Resource and DataType.
 AgentClient getAgentClientForSchedule(MeasurementSchedule sched)
          Get the AgentClient (the connection to the agent) that is associated with the given schedule.
 MeasurementSchedule getSchedule(Subject subject, int resourceId, int definitionId, boolean attachBaseline)
          Find MeasurementSchedules that are attached to a certain definition and a resource
 MeasurementSchedule getScheduleById(Subject subject, int scheduleId)
          Obtain a MeasurementSchedule by its Id after a check for a valid session
 int getScheduledMeasurementsPerMinute()
           
 int insertSchedulesFor(int[] batchIds)
           
 int returnSchedulesFor(int[] batchIds, java.util.Set<ResourceMeasurementScheduleRequest> allSchedules)
           
 void updateDefaultCollectionIntervalForMeasurementDefinitions(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(Subject subject, int[] measurementDefinitionIds, long collectionInterval)
           
 void updateSchedule(Subject subject, MeasurementSchedule schedule)
          Reattach a Schedule to a PersitenceContext after a successful check for a valid session
 void updateSchedulesForAutoGroup(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(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.
 void updateSchedulesForResource(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

java.util.Set<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(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

java.util.List<MeasurementSchedule> findSchedulesByResourceIdAndDefinitionIds(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

MeasurementSchedule getScheduleById(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

MeasurementSchedule getSchedule(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

findScheduleCompositesForResource

PageList<MeasurementScheduleComposite> findScheduleCompositesForResource(Subject subject,
                                                                         int resourceId,
                                                                         @Nullable
                                                                         DataType dataType,
                                                                         PageControl pageControl)
Retrieves the metric collection schedules for the given resource.

Parameters:
subject - the current user
resourceId - a Resource id
dataType - the data type to limit results to, or null to not limit results to a particular data type
pageControl - the page control for the results
Returns:
the metric collection schedules for the given resource

disableDefaultCollectionForMeasurementDefinitions

void disableDefaultCollectionForMeasurementDefinitions(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(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(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(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 Permission.MANAGE_SETTINGS
measurementDefinitionIds - The primary keys for the definitions
collectionInterval - the new interval in millisconds for collection
updateExistingSchedules - If true, then existing schedules for this definition will also be updated.

updateSchedulesForAutoGroup

void updateSchedulesForAutoGroup(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

java.util.List<MeasurementSchedule> findSchedulesForResourceAndType(Subject subject,
                                                                    int resourceId,
                                                                    DataType dataType,
                                                                    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(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(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(ResourceType type,
                                         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 java.lang.Exception
Throws:
java.lang.Exception

returnSchedulesFor

int returnSchedulesFor(int[] batchIds,
                       java.util.Set<ResourceMeasurementScheduleRequest> allSchedules)
                       throws java.lang.Exception
Throws:
java.lang.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

java.util.List<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

java.util.List<MeasurementSchedule> findSchedulesByResourceIdsAndDefinitionId(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

findSchedulesForAutoGroup

PageList<MeasurementScheduleComposite> findSchedulesForAutoGroup(Subject subject,
                                                                 int parentId,
                                                                 int childType,
                                                                 PageControl pageControl)
Get the MeasurementSchedule composites for an autogroup

Parameters:
subject -
parentId -
childType -
pageControl -
Returns:

findSchedulesForCompatibleGroup

PageList<MeasurementScheduleComposite> findSchedulesForCompatibleGroup(Subject subject,
                                                                       int groupId,
                                                                       PageControl pageControl)

findSchedulesForResource

PageList<MeasurementScheduleComposite> findSchedulesForResource(Subject subject,
                                                                int resourceId,
                                                                PageControl pageControl)
Retrieves the metric collection schedules for the given resource.

Parameters:
subject - the current user
resourceId - a Resource id
pageControl - the page control for the results
Returns:
the metric collection schedules for the given resource

disableSchedulesForResource

void disableSchedulesForResource(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(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(Subject subject,
                                 int[] measurementDefinitionIds)

enableSchedulesForResource

void enableSchedulesForResource(Subject subject,
                                int resourceId,
                                int[] measurementDefinitionIds)
Enable the schedules for the provided definitions and resource

Parameters:
subject -
measurementDefinitionIds -
resourceId -

enableSchedulesForCompatibleGroup

void enableSchedulesForCompatibleGroup(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(Subject subject,
                                int[] measurementDefinitionIds)

updateSchedule

void updateSchedule(Subject subject,
                    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(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(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(Subject subject,
                                int[] measurementDefinitionIds,
                                long collectionInterval)

findSchedulesByCriteria

PageList<MeasurementSchedule> findSchedulesByCriteria(Subject subject,
                                                      MeasurementScheduleCriteria criteria)


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